From 2e2ed1385fbae6c102156a08fce2defb642e52c5 Mon Sep 17 00:00:00 2001 From: syuilo Date: Sun, 8 Jan 2023 10:54:45 +0900 Subject: [PATCH] delete pollVote notification --- CHANGELOG.md | 1 + locales/ja-JP.yml | 2 - packages/backend/src/core/PollService.ts | 7 -- .../entities/NotificationEntityService.ts | 2 +- .../src/models/entities/Notification.ts | 10 +-- .../server/api/endpoints/notes/polls/vote.ts | 7 -- .../src/components/MkNotification.vue | 12 ---- .../sw/src/scripts/create-notification.ts | 68 ++++++++----------- 8 files changed, 37 insertions(+), 72 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 78caef325..e43788112 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -30,6 +30,7 @@ You should also include the user name that made the change. #### For users - ノートのウォッチ機能が削除されました +- アンケートに投票された際に通知が作成されなくなりました - 新たに動的なPagesを作ることはできなくなりました - 代わりにAiScriptを用いてより柔軟に動的なコンテンツを作成できるMisskey Play機能が実装されています。 - AiScriptが0.12.2にアップデートされました diff --git a/locales/ja-JP.yml b/locales/ja-JP.yml index b49d872a0..3445e5835 100644 --- a/locales/ja-JP.yml +++ b/locales/ja-JP.yml @@ -1550,7 +1550,6 @@ _notification: youGotReply: "{name}からのリプライ" youGotQuote: "{name}による引用" youRenoted: "{name}がRenoteしました" - youGotPoll: "{name}が投票しました" youGotMessagingMessageFromUser: "{name}からのチャットがあります" youGotMessagingMessageFromGroup: "{name}のチャットがあります" youWereFollowed: "フォローされました" @@ -1569,7 +1568,6 @@ _notification: renote: "Renote" quote: "引用" reaction: "リアクション" - pollVote: "アンケートに投票された" pollEnded: "アンケートが終了" receiveFollowRequest: "フォロー申請を受け取った" followRequestAccepted: "フォローが受理された" diff --git a/packages/backend/src/core/PollService.ts b/packages/backend/src/core/PollService.ts index 3cc9b0cc9..abc598ab7 100644 --- a/packages/backend/src/core/PollService.ts +++ b/packages/backend/src/core/PollService.ts @@ -92,13 +92,6 @@ export class PollService { choice: choice, userId: user.id, }); - - // Notify - this.createNotificationService.createNotification(note.userId, 'pollVote', { - notifierId: user.id, - noteId: note.id, - choice: choice, - }); } @bindThis diff --git a/packages/backend/src/core/entities/NotificationEntityService.ts b/packages/backend/src/core/entities/NotificationEntityService.ts index 208d65387..a1c2c9cff 100644 --- a/packages/backend/src/core/entities/NotificationEntityService.ts +++ b/packages/backend/src/core/entities/NotificationEntityService.ts @@ -98,7 +98,7 @@ export class NotificationEntityService implements OnModuleInit { }), reaction: notification.reaction, } : {}), - ...(notification.type === 'pollVote' ? { + ...(notification.type === 'pollVote' ? { // TODO: そのうち消す note: this.noteEntityService.pack(notification.note ?? notification.noteId!, { id: notification.notifieeId }, { detail: true, _hint_: options._hintForEachNotes_, diff --git a/packages/backend/src/models/entities/Notification.ts b/packages/backend/src/models/entities/Notification.ts index 53a7dda43..6679cdb80 100644 --- a/packages/backend/src/models/entities/Notification.ts +++ b/packages/backend/src/models/entities/Notification.ts @@ -55,11 +55,11 @@ export class Notification { * 通知の種類。 * follow - フォローされた * mention - 投稿で自分が言及された - * reply - (自分または自分がWatchしている)投稿が返信された - * renote - (自分または自分がWatchしている)投稿がRenoteされた - * quote - (自分または自分がWatchしている)投稿が引用Renoteされた - * reaction - (自分または自分がWatchしている)投稿にリアクションされた - * pollVote - (自分または自分がWatchしている)投稿のアンケートに投票された + * reply - 投稿に返信された + * renote - 投稿がRenoteされた + * quote - 投稿が引用Renoteされた + * reaction - 投稿にリアクションされた + * pollVote - 投稿のアンケートに投票された (廃止) * pollEnded - 自分のアンケートもしくは自分が投票したアンケートが終了した * receiveFollowRequest - フォローリクエストされた * followRequestAccepted - 自分の送ったフォローリクエストが承認された diff --git a/packages/backend/src/server/api/endpoints/notes/polls/vote.ts b/packages/backend/src/server/api/endpoints/notes/polls/vote.ts index 793d7c540..d583dfb93 100644 --- a/packages/backend/src/server/api/endpoints/notes/polls/vote.ts +++ b/packages/backend/src/server/api/endpoints/notes/polls/vote.ts @@ -162,13 +162,6 @@ export default class extends Endpoint { userId: me.id, }); - // Notify - this.createNotificationService.createNotification(note.userId, 'pollVote', { - notifierId: me.id, - noteId: note.id, - choice: ps.choice, - }); - // リモート投票の場合リプライ送信 if (note.userHost != null) { const pollOwner = await this.usersRepository.findOneByOrFail({ id: note.userId }) as IRemoteUser; diff --git a/packages/frontend/src/components/MkNotification.vue b/packages/frontend/src/components/MkNotification.vue index a21a9e12a..2b9f9a2bb 100644 --- a/packages/frontend/src/components/MkNotification.vue +++ b/packages/frontend/src/components/MkNotification.vue @@ -13,7 +13,6 @@ - - - - - - @@ -239,12 +233,6 @@ useTooltip(reactionRef, (showing) => { pointer-events: none; } - &.pollVote { - padding: 3px; - background: #88a6b7; - pointer-events: none; - } - &.pollEnded { padding: 3px; background: #88a6b7; diff --git a/packages/sw/src/scripts/create-notification.ts b/packages/sw/src/scripts/create-notification.ts index a324851fe..4b006e0f5 100644 --- a/packages/sw/src/scripts/create-notification.ts +++ b/packages/sw/src/scripts/create-notification.ts @@ -51,8 +51,8 @@ async function composeNotification(data actions: userDetail.isFollowing ? [] : [ { action: 'follow', - title: t('_notification._actions.followBack') - } + title: t('_notification._actions.followBack'), + }, ], }]; } @@ -66,8 +66,8 @@ async function composeNotification(data actions: [ { action: 'reply', - title: t('_notification._actions.reply') - } + title: t('_notification._actions.reply'), + }, ], }]; @@ -80,8 +80,8 @@ async function composeNotification(data actions: [ { action: 'reply', - title: t('_notification._actions.reply') - } + title: t('_notification._actions.reply'), + }, ], }]; @@ -94,8 +94,8 @@ async function composeNotification(data actions: [ { action: 'showUser', - title: getUserName(data.body.user) - } + title: getUserName(data.body.user), + }, ], }]; @@ -108,14 +108,14 @@ async function composeNotification(data actions: [ { action: 'reply', - title: t('_notification._actions.reply') + title: t('_notification._actions.reply'), }, ...((data.body.note.visibility === 'public' || data.body.note.visibility === 'home') ? [ - { - action: 'renote', - title: t('_notification._actions.renote') - } - ] : []) + { + action: 'renote', + title: t('_notification._actions.renote'), + }, + ] : []), ], }]; @@ -141,7 +141,7 @@ async function composeNotification(data const dummy = `${encodeURIComponent(`${u.host}${u.pathname}`)}.png`; badge = `${origin}/proxy/${dummy}?${url.query({ url: u.href, - badge: '1' + badge: '1', })}`; } } @@ -162,20 +162,12 @@ async function composeNotification(data actions: [ { action: 'showUser', - title: getUserName(data.body.user) - } + title: getUserName(data.body.user), + }, ], }]; } - case 'pollVote': - return [t('_notification.youGotPoll', { name: getUserName(data.body.user) }), { - body: data.body.note.text || '', - icon: data.body.user.avatarUrl, - badge: iconUrl('poll-h'), - data, - }]; - case 'pollEnded': return [t('_notification.pollEnded'), { body: data.body.note.text || '', @@ -192,12 +184,12 @@ async function composeNotification(data actions: [ { action: 'accept', - title: t('accept') + title: t('accept'), }, { action: 'reject', - title: t('reject') - } + title: t('reject'), + }, ], }]; @@ -217,21 +209,21 @@ async function composeNotification(data actions: [ { action: 'accept', - title: t('accept') + title: t('accept'), }, { action: 'reject', - title: t('reject') - } + title: t('reject'), + }, ], }]; case 'app': - return [data.body.header || data.body.body, { - body: data.body.header && data.body.body, - icon: data.body.icon, - data - }]; + return [data.body.header || data.body.body, { + body: data.body.header && data.body.body, + icon: data.body.icon, + data, + }]; default: return null; @@ -279,7 +271,7 @@ export async function createEmptyNotification() { silent: true, badge: iconUrl('null'), tag: 'read_notification', - } + }, ); res(); @@ -288,7 +280,7 @@ export async function createEmptyNotification() { for (const n of [ ...(await self.registration.getNotifications({ tag: 'user_visible_auto_notification' })), - ...(await self.registration.getNotifications({ tag: 'read_notification' })) + ...(await self.registration.getNotifications({ tag: 'read_notification' })), ] ) { n.close();