From ab1b34d4d2c503a11d6e8f67a606e354a4285488 Mon Sep 17 00:00:00 2001 From: Lim Chee Aun Date: Sat, 14 Oct 2023 17:59:18 +0800 Subject: [PATCH] Fix handling of admin.report notification This is untested, may break. --- src/components/notification.jsx | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/components/notification.jsx b/src/components/notification.jsx index 7811290c..e02beea3 100644 --- a/src/components/notification.jsx +++ b/src/components/notification.jsx @@ -58,14 +58,14 @@ const contentText = { 'favourite+reblog+account': (count) => `boosted & favourited ${count} of your posts.`, 'favourite+reblog_reply': 'boosted & favourited your reply.', - 'admin.report': 'reported a post.', 'admin.sign_up': 'signed up.', + 'admin.report': (targetAccount) => <>reported {targetAccount}, }; const AVATARS_LIMIT = 50; function Notification({ notification, instance, reload, isStatic }) { - const { id, status, account, _accounts, _statuses } = notification; + const { id, status, account, report, _accounts, _statuses } = notification; let { type } = notification; // status = Attached when type of the notification is favourite, reblog, status, mention, poll, or update @@ -119,7 +119,15 @@ function Notification({ notification, instance, reload, isStatic }) { } if (typeof text === 'function') { - text = text(_statuses?.length || _accounts?.length); + const count = _statuses?.length || _accounts?.length; + if (count) { + text = text(count); + } else if (type === 'admin.report') { + const targetAccount = report?.targetAccount; + if (targetAccount) { + text = text(); + } + } } if (type === 'mention' && !status) {