summaryrefslogtreecommitdiff
path: root/packages/client/src/components
diff options
context:
space:
mode:
authorsyuilo <Syuilotan@yahoo.co.jp>2022-03-06 16:06:27 +0900
committersyuilo <Syuilotan@yahoo.co.jp>2022-03-06 16:06:27 +0900
commit2442592ef1a51cad901cf5e7fe30cdc85d7568cc (patch)
tree668e11d1d94b023a3fcd49a5daba8c0d96b7fd71 /packages/client/src/components
parentUpdate CHANGELOG.md (diff)
downloadmisskey-2442592ef1a51cad901cf5e7fe30cdc85d7568cc.tar.gz
misskey-2442592ef1a51cad901cf5e7fe30cdc85d7568cc.tar.bz2
misskey-2442592ef1a51cad901cf5e7fe30cdc85d7568cc.zip
feat: アンケート終了通知
Resolve #4664
Diffstat (limited to 'packages/client/src/components')
-rw-r--r--packages/client/src/components/notification.vue19
-rw-r--r--packages/client/src/components/notifications.vue7
2 files changed, 20 insertions, 6 deletions
diff --git a/packages/client/src/components/notification.vue b/packages/client/src/components/notification.vue
index d855f81f8a..1a360f9905 100644
--- a/packages/client/src/components/notification.vue
+++ b/packages/client/src/components/notification.vue
@@ -1,7 +1,8 @@
<template>
<div ref="elRef" v-size="{ max: [500, 600] }" class="qglefbjs" :class="notification.type">
<div class="head">
- <MkAvatar v-if="notification.user" class="icon" :user="notification.user"/>
+ <MkAvatar v-if="notification.type === 'pollEnded'" class="icon" :user="notification.note.user"/>
+ <MkAvatar v-else-if="notification.user" class="icon" :user="notification.user"/>
<img v-else-if="notification.icon" class="icon" :src="notification.icon" alt=""/>
<div class="sub-icon" :class="notification.type">
<i v-if="notification.type === 'follow'" class="fas fa-plus"></i>
@@ -13,6 +14,7 @@
<i v-else-if="notification.type === 'mention'" class="fas fa-at"></i>
<i v-else-if="notification.type === 'quote'" class="fas fa-quote-left"></i>
<i v-else-if="notification.type === 'pollVote'" class="fas fa-poll-h"></i>
+ <i v-else-if="notification.type === 'pollEnded'" class="fas fa-poll-h"></i>
<!-- notification.reaction が null になることはまずないが、ここでoptional chaining使うと一部ブラウザで刺さるので念の為 -->
<XReactionIcon v-else-if="notification.type === 'reaction'"
ref="reactionRef"
@@ -24,7 +26,8 @@
</div>
<div class="tail">
<header>
- <MkA v-if="notification.user" v-user-preview="notification.user.id" class="name" :to="userPage(notification.user)"><MkUserName :user="notification.user"/></MkA>
+ <span v-if="notification.type === 'pollEnded'">{{ i18n.ts._notification.pollEnded }}</span>
+ <MkA v-else-if="notification.user" v-user-preview="notification.user.id" class="name" :to="userPage(notification.user)"><MkUserName :user="notification.user"/></MkA>
<span v-else>{{ notification.header }}</span>
<MkTime v-if="withTime" :time="notification.createdAt" class="time"/>
</header>
@@ -52,6 +55,11 @@
<Mfm :text="getNoteSummary(notification.note)" :plain="true" :nowrap="!full" :custom-emojis="notification.note.emojis"/>
<i class="fas fa-quote-right"></i>
</MkA>
+ <MkA v-if="notification.type === 'pollEnded'" class="text" :to="notePage(notification.note)" :title="getNoteSummary(notification.note)">
+ <i class="fas fa-quote-left"></i>
+ <Mfm :text="getNoteSummary(notification.note)" :plain="true" :nowrap="!full" :custom-emojis="notification.note.emojis"/>
+ <i class="fas fa-quote-right"></i>
+ </MkA>
<span v-if="notification.type === 'follow'" class="text" style="opacity: 0.6;">{{ $ts.youGotNewFollower }}<div v-if="full"><MkFollowButton :user="notification.user" :full="true"/></div></span>
<span v-if="notification.type === 'followRequestAccepted'" class="text" style="opacity: 0.6;">{{ $ts.followRequestAccepted }}</span>
<span v-if="notification.type === 'receiveFollowRequest'" class="text" style="opacity: 0.6;">{{ $ts.receiveFollowRequest }}<div v-if="full && !followRequestDone"><button class="_textButton" @click="acceptFollowRequest()">{{ $ts.accept }}</button> | <button class="_textButton" @click="rejectFollowRequest()">{{ $ts.reject }}</button></div></span>
@@ -169,6 +177,7 @@ export default defineComponent({
rejectGroupInvitation,
elRef,
reactionRef,
+ i18n,
};
},
});
@@ -274,6 +283,12 @@ export default defineComponent({
background: #88a6b7;
pointer-events: none;
}
+
+ &.pollEnded {
+ padding: 3px;
+ background: #88a6b7;
+ pointer-events: none;
+ }
}
}
diff --git a/packages/client/src/components/notifications.vue b/packages/client/src/components/notifications.vue
index 5a77b5487e..c3753076ac 100644
--- a/packages/client/src/components/notifications.vue
+++ b/packages/client/src/components/notifications.vue
@@ -35,19 +35,18 @@ const props = defineProps<{
const pagingComponent = ref<InstanceType<typeof MkPagination>>();
-const allIncludeTypes = computed(() => props.includeTypes ?? notificationTypes.filter(x => !$i.mutingNotificationTypes.includes(x)));
-
const pagination: Paging = {
endpoint: 'i/notifications' as const,
limit: 10,
params: computed(() => ({
- includeTypes: allIncludeTypes.value || undefined,
+ includeTypes: props.includeTypes ?? undefined,
+ excludeTypes: props.includeTypes ? undefined : $i.mutingNotificationTypes,
unreadOnly: props.unreadOnly,
})),
};
const onNotification = (notification) => {
- const isMuted = !allIncludeTypes.value.includes(notification.type);
+ const isMuted = props.includeTypes ? !props.includeTypes.includes(notification.type) : $i.mutingNotificationTypes.includes(notification.type);
if (isMuted || document.visibilityState === 'visible') {
stream.send('readNotification', {
id: notification.id