From 1f720366e94c175f171156a86d65787d6f0d7ba6 Mon Sep 17 00:00:00 2001 From: Claire Date: Fri, 4 Oct 2024 16:29:23 +0200 Subject: [PATCH] Fix notification push notifications not including the author's username (#32254) --- app/javascript/mastodon/locales/en.json | 1 + .../mastodon/service_worker/web_push_locales.js | 8 +++++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/app/javascript/mastodon/locales/en.json b/app/javascript/mastodon/locales/en.json index 1e78745359..7f8dc74779 100644 --- a/app/javascript/mastodon/locales/en.json +++ b/app/javascript/mastodon/locales/en.json @@ -516,6 +516,7 @@ "notification.label.private_reply": "Private reply", "notification.label.reply": "Reply", "notification.mention": "Mention", + "notification.mentioned_you": "{name} mentioned you", "notification.moderation-warning.learn_more": "Learn more", "notification.moderation_warning": "You have received a moderation warning", "notification.moderation_warning.action_delete_statuses": "Some of your posts have been removed.", diff --git a/app/javascript/mastodon/service_worker/web_push_locales.js b/app/javascript/mastodon/service_worker/web_push_locales.js index 89ae20007b..3e39c9a4ed 100644 --- a/app/javascript/mastodon/service_worker/web_push_locales.js +++ b/app/javascript/mastodon/service_worker/web_push_locales.js @@ -6,6 +6,12 @@ const fs = require('fs'); const path = require('path'); +const { defineMessages } = require('react-intl'); + +const messages = defineMessages({ + mentioned_you: { id: 'notification.mentioned_you', defaultMessage: '{name} mentioned you' }, +}); + const filtered = {}; const filenames = fs.readdirSync(path.resolve(__dirname, '../locales')); @@ -20,7 +26,7 @@ filenames.forEach(filename => { 'notification.favourite': full['notification.favourite'] || '', 'notification.follow': full['notification.follow'] || '', 'notification.follow_request': full['notification.follow_request'] || '', - 'notification.mention': full['notification.mention'] || '', + 'notification.mention': full[messages.mentioned_you.id] || '', 'notification.reblog': full['notification.reblog'] || '', 'notification.poll': full['notification.poll'] || '', 'notification.status': full['notification.status'] || '',