From 7ce6a9bbaffddc6019ce2eab8b7a06c119ff2f69 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=81=8B=E3=81=A3=E3=81=93=E3=81=8B=E3=82=8A?= <67428053+kakkokari-gtyih@users.noreply.github.com> Date: Sat, 27 Apr 2024 19:59:30 +0900 Subject: [PATCH] =?UTF-8?q?fix(frontend):=20=E3=82=B0=E3=83=AB=E3=83=BC?= =?UTF-8?q?=E3=83=97=E9=80=9A=E7=9F=A5=E3=81=AE=E4=BA=BA=E6=95=B0=E3=82=92?= =?UTF-8?q?=E3=81=A1=E3=82=83=E3=82=93=E3=81=A8=E6=95=B0=E3=81=88=E3=82=8B?= =?UTF-8?q?=E3=82=88=E3=81=86=E3=81=AB=20(#13751)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix(frontend): グループ通知の人数をちゃんと数えるように * Update Changelog --- CHANGELOG.md | 1 + packages/frontend/src/components/MkNotification.vue | 11 ++++++++--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a263680782..1a43649fdb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -53,6 +53,7 @@ - Fix: ダイレクト投稿の宛先が保存されない問題を修正 - Fix: Playのページを離れたときに、Playが正常に初期化されない問題を修正 - Fix: ページのOGP URLが間違っているのを修正 +- Fix: 通知をグループ化している際に、人数が正常に表示されないことがある問題を修正 ### Server - Enhance: エンドポイント`antennas/update`の必須項目を`antennaId`のみに diff --git a/packages/frontend/src/components/MkNotification.vue b/packages/frontend/src/components/MkNotification.vue index 0d3a5c13ba..73cd7cd5b3 100644 --- a/packages/frontend/src/components/MkNotification.vue +++ b/packages/frontend/src/components/MkNotification.vue @@ -58,8 +58,8 @@ SPDX-License-Identifier: AGPL-3.0-only {{ i18n.ts._notification.achievementEarned }} {{ i18n.ts._notification.testNotification }} - {{ i18n.tsx._notification.likedBySomeUsers({ n: notification.reactions.length }) }} - {{ i18n.tsx._notification.reactedBySomeUsers({ n: notification.reactions.length }) }} + {{ i18n.tsx._notification.likedBySomeUsers({ n: getActualReactedUsersCount(notification) }) }} + {{ i18n.tsx._notification.reactedBySomeUsers({ n: getActualReactedUsersCount(notification) }) }} {{ i18n.tsx._notification.renotedBySomeUsers({ n: notification.users.length }) }} {{ notification.header }} @@ -72,7 +72,7 @@ SPDX-License-Identifier: AGPL-3.0-only - + @@ -174,6 +174,11 @@ const rejectFollowRequest = () => { followRequestDone.value = true; misskeyApi('following/requests/reject', { userId: props.notification.user.id }); }; + +function getActualReactedUsersCount(notification: Misskey.entities.Notification) { + if (notification.type !== 'reaction:grouped') return 0; + return new Set(notification.reactions.map((reaction) => reaction.user.id)).size; +}