From 6c483f5ff19793df1ed7ea7bbccd961b9174c35c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?KMY=EF=BC=88=E9=9B=AA=E3=81=82=E3=81=99=E3=81=8B=EF=BC=89?= Date: Sat, 24 Aug 2024 09:31:32 +0900 Subject: [PATCH] =?UTF-8?q?Fix:=20#815=20=E3=83=87=E3=82=B9=E3=82=AF?= =?UTF-8?q?=E3=83=88=E3=83=83=E3=83=97=E9=80=9A=E7=9F=A5=E7=94=A8=E3=81=AE?= =?UTF-8?q?=E3=83=A1=E3=83=83=E3=82=BB=E3=83=BC=E3=82=B8=E3=81=AE=E7=BF=BB?= =?UTF-8?q?=E8=A8=B3=E3=81=8C=E5=AD=98=E5=9C=A8=E3=81=97=E3=81=AA=E3=81=84?= =?UTF-8?q?=E8=A8=80=E8=AA=9E=E3=81=AB=E8=A8=AD=E5=AE=9A=E3=81=97=E3=81=A6?= =?UTF-8?q?=E3=81=84=E3=82=8B=E5=A0=B4=E5=90=88=E3=80=81=E3=83=87=E3=82=B9?= =?UTF-8?q?=E3=82=AF=E3=83=88=E3=83=83=E3=83=97=E9=80=9A=E7=9F=A5=E3=82=92?= =?UTF-8?q?=E5=8F=97=E3=81=91=E5=8F=96=E3=82=8B=E8=A8=AD=E5=AE=9A=E3=81=AB?= =?UTF-8?q?=E3=81=97=E3=81=9F=E7=A8=AE=E5=88=A5=E3=81=AE=E9=80=9A=E7=9F=A5?= =?UTF-8?q?=E3=81=8C=E3=83=AA=E3=82=A2=E3=83=AB=E3=82=BF=E3=82=A4=E3=83=A0?= =?UTF-8?q?=E3=81=A7=E7=A2=BA=E8=AA=8D=E3=81=A7=E3=81=8D=E3=81=AA=E3=81=84?= =?UTF-8?q?=20(#819)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mastodon/actions/notifications.js | 20 ++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/app/javascript/mastodon/actions/notifications.js b/app/javascript/mastodon/actions/notifications.js index 4bea055e4d..deb4cec278 100644 --- a/app/javascript/mastodon/actions/notifications.js +++ b/app/javascript/mastodon/actions/notifications.js @@ -81,6 +81,20 @@ export const NOTIFICATIONS_FOR_REQUEST_EXPAND_REQUEST = 'NOTIFICATIONS_FOR_REQUE export const NOTIFICATIONS_FOR_REQUEST_EXPAND_SUCCESS = 'NOTIFICATIONS_FOR_REQUEST_EXPAND_SUCCESS'; export const NOTIFICATIONS_FOR_REQUEST_EXPAND_FAIL = 'NOTIFICATIONS_FOR_REQUEST_EXPAND_FAIL'; +const DEFAULT_NOTIFICATION_MESSAGES = { + 'notification.admin.report': '{name} reported {target}', + 'notification.admin.sign_up': '{name} signed up', + 'notification.emoji_reaction': '{name} reacted your post with emoji', + 'notification.favourite': '{name} favorited your post', + 'notification.follow': '{name} followed you', + 'notification.list_status': '{name} post is added to {listName}', + 'notification.poll': 'A poll you voted in has ended', + 'notification.reblog': '{name} boosted your post', + 'notification.status': '{name} just posted', + 'notification.status_reference': '{name} quoted your post', + 'notification.update': '{name} edited a post', +}; + defineMessages({ mention: { id: 'notification.mention', defaultMessage: '{name} mentioned you' }, group: { id: 'notifications.group', defaultMessage: '{count} notifications' }, @@ -161,7 +175,11 @@ export function updateNotifications(notification, intlMessages, intlLocale) { // Desktop notifications if (typeof window.Notification !== 'undefined' && showAlert && !filtered) { - const title = new IntlMessageFormat(intlMessages[`notification.${notification.type}`], intlLocale).format({ name: notification.account.display_name.length > 0 ? notification.account.display_name : notification.account.username }); + const messageTemplate = intlMessages[`notification.${notification.type}`] || DEFAULT_NOTIFICATION_MESSAGES[`notification.${notification.type}`]; + const title = new IntlMessageFormat(messageTemplate, intlLocale).format({ + name: notification.account.display_name.length > 0 ? notification.account.display_name : notification.account.username, + listName: notification.list && notification.list.title, + }); const body = (notification.status && notification.status.spoiler_text.length > 0) ? notification.status.spoiler_text : unescapeHTML(notification.status ? notification.status.content : ''); const notify = new Notification(title, { body, icon: notification.account.avatar, tag: notification.id });