From b1dc43a9c94b5698a51093b8d3944cbe31f0daa9 Mon Sep 17 00:00:00 2001 From: Nolan Lawson Date: Sun, 11 Dec 2022 12:01:01 -0800 Subject: [PATCH] fix: show proper notification text for follow request (#2314) Fixes #1800 --- src/intl/en-US.js | 2 ++ src/routes/_api/timelines.js | 2 +- src/routes/_components/status/Notification.html | 2 ++ src/routes/_components/status/StatusHeader.html | 4 ++++ src/service-worker.js | 1 + 5 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/intl/en-US.js b/src/intl/en-US.js index d3744d35..c12ef9f8 100644 --- a/src/intl/en-US.js +++ b/src/intl/en-US.js @@ -497,6 +497,7 @@ export default { }: {description}`, accountFollowedYou: '{name} followed you, {account}', accountSignedUp: '{name} signed up, {account}', + accountRequestedFollow: '{name} requested to follow you, {account}', reblogCountsHidden: 'Boost counts hidden', favoriteCountsHidden: 'Favorite counts hidden', rebloggedTimes: `Boosted {count, plural, @@ -512,6 +513,7 @@ export default { favoritedYou: 'favorited your toot', followedYou: 'followed you', edited: 'edited their toot', + requestedFollow: 'requested to follow you', signedUp: 'signed up', posted: 'posted', pollYouCreatedEnded: 'A poll you created has ended', diff --git a/src/routes/_api/timelines.js b/src/routes/_api/timelines.js index 56cec1d5..a91cc74e 100644 --- a/src/routes/_api/timelines.js +++ b/src/routes/_api/timelines.js @@ -66,7 +66,7 @@ export async function getTimeline (instanceName, accessToken, timeline, maxId, s } if (timeline === 'notifications/mentions') { - params.exclude_types = ['follow', 'favourite', 'reblog', 'poll', 'admin.sign_up'] + params.exclude_types = ['follow', 'favourite', 'reblog', 'poll', 'admin.sign_up', 'update', 'follow_request'] } url += '?' + paramsString(params) diff --git a/src/routes/_components/status/Notification.html b/src/routes/_components/status/Notification.html index 4f530205..dbcdf0fb 100644 --- a/src/routes/_components/status/Notification.html +++ b/src/routes/_components/status/Notification.html @@ -76,6 +76,8 @@ } if (notificationType === 'admin.sign_up') { return formatIntl('intl.accountSignedUp', params) + } else if (notificationType === 'follow_request') { + return formatIntl('intl.accountRequestedFollow', params) } else { // 'follow' return formatIntl('intl.accountFollowedYou', params) } diff --git a/src/routes/_components/status/StatusHeader.html b/src/routes/_components/status/StatusHeader.html index 69853446..59f3393f 100644 --- a/src/routes/_components/status/StatusHeader.html +++ b/src/routes/_components/status/StatusHeader.html @@ -139,6 +139,8 @@ return '#fa-user-plus' } else if (notificationType === 'update') { return '#fa-pencil' + } else if (notificationType === 'follow_request') { + return '#fa-hourglass' } return '#fa-star' }, @@ -163,6 +165,8 @@ return 'intl.reblogged' } else if (notificationType === 'update') { return 'intl.edited' + } else if (notificationType === 'follow_request') { + return 'intl.requestedFollow' } else { return '' } diff --git a/src/service-worker.js b/src/service-worker.js index c95926a3..be26f0f7 100644 --- a/src/service-worker.js +++ b/src/service-worker.js @@ -215,6 +215,7 @@ async function showRichNotification (data, notification) { switch (notification.type) { case 'follow': + case 'follow_request': case 'admin.sign_up': { await self.registration.showNotification(data.title, { badge,