From 2feef8151625d9ba5d9c8b1850679b7fe84af809 Mon Sep 17 00:00:00 2001
From: syuilo <Syuilotan@yahoo.co.jp>
Date: Thu, 13 Feb 2020 02:17:54 +0900
Subject: グループ招待の通知とか
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Resolve #5880
Resolve #5927
---
 src/client/components/notification.vue | 21 ++++++++++++++++++---
 1 file changed, 18 insertions(+), 3 deletions(-)

(limited to 'src/client/components/notification.vue')

diff --git a/src/client/components/notification.vue b/src/client/components/notification.vue
index e2a220a074..50aff29dd7 100644
--- a/src/client/components/notification.vue
+++ b/src/client/components/notification.vue
@@ -6,6 +6,7 @@
 			<fa :icon="faPlus" v-if="notification.type === 'follow'"/>
 			<fa :icon="faClock" v-if="notification.type === 'receiveFollowRequest'"/>
 			<fa :icon="faCheck" v-if="notification.type === 'followRequestAccepted'"/>
+			<fa :icon="faIdCardAlt" v-if="notification.type === 'groupInvited'"/>
 			<fa :icon="faRetweet" v-if="notification.type === 'renote'"/>
 			<fa :icon="faReply" v-if="notification.type === 'reply'"/>
 			<fa :icon="faAt" v-if="notification.type === 'mention'"/>
@@ -40,13 +41,14 @@
 		<span v-if="notification.type === 'follow'" class="text" style="opacity: 0.6;">{{ $t('youGotNewFollower') }}<div v-if="full"><mk-follow-button :user="notification.user" :full="true"/></div></span>
 		<span v-if="notification.type === 'followRequestAccepted'" class="text" style="opacity: 0.6;">{{ $t('followRequestAccepted') }}</span>
 		<span v-if="notification.type === 'receiveFollowRequest'" class="text" style="opacity: 0.6;">{{ $t('receiveFollowRequest') }}<div v-if="full && !followRequestDone"><button class="_textButton" @click="acceptFollowRequest()">{{ $t('accept') }}</button> | <button class="_textButton" @click="rejectFollowRequest()">{{ $t('reject') }}</button></div></span>
+		<span v-if="notification.type === 'groupInvited'" class="text" style="opacity: 0.6;">{{ $t('groupInvited') }}: <b>{{ notification.invitation.group.name }}</b><div v-if="full && !groupInviteDone"><button class="_textButton" @click="acceptGroupInvitation()">{{ $t('accept') }}</button> | <button class="_textButton" @click="rejectGroupInvitation()">{{ $t('reject') }}</button></div></span>
 	</div>
 </div>
 </template>
 
 <script lang="ts">
 import Vue from 'vue';
-import { faPlus, faQuoteLeft, faQuoteRight, faRetweet, faReply, faAt, faCheck } from '@fortawesome/free-solid-svg-icons';
+import { faIdCardAlt, faPlus, faQuoteLeft, faQuoteRight, faRetweet, faReply, faAt, faCheck } from '@fortawesome/free-solid-svg-icons';
 import { faClock } from '@fortawesome/free-regular-svg-icons';
 import getNoteSummary from '../../misc/get-note-summary';
 import XReactionIcon from './reaction-icon.vue';
@@ -78,7 +80,8 @@ export default Vue.extend({
 		return {
 			getNoteSummary,
 			followRequestDone: false,
-			faPlus, faQuoteLeft, faQuoteRight, faRetweet, faReply, faAt, faClock, faCheck
+			groupInviteDone: false,
+			faIdCardAlt, faPlus, faQuoteLeft, faQuoteRight, faRetweet, faReply, faAt, faClock, faCheck
 		};
 	},
 	methods: {
@@ -90,6 +93,18 @@ export default Vue.extend({
 			this.followRequestDone = true;
 			this.$root.api('following/requests/reject', { userId: this.notification.user.id });
 		},
+		acceptGroupInvitation() {
+			this.groupInviteDone = true;
+			this.$root.api('users/groups/invitations/accept', { invitationId: this.notification.invitation.id });
+			this.$root.dialog({
+				type: 'success',
+				iconOnly: true, autoClose: true
+			});
+		},
+		rejectGroupInvitation() {
+			this.groupInviteDone = true;
+			this.$root.api('users/groups/invitations/reject', { invitationId: this.notification.invitation.id });
+		},
 	}
 });
 </script>
@@ -149,7 +164,7 @@ export default Vue.extend({
 				height: 100%;
 			}
 
-			&.follow, &.followRequestAccepted, &.receiveFollowRequest {
+			&.follow, &.followRequestAccepted, &.receiveFollowRequest, &.groupInvited {
 				padding: 3px;
 				background: #36aed2;
 			}
-- 
cgit v1.2.3-freya

