Skip to content

Commit

Permalink
fix: show proper text for signup notifications (nolanlawson#2182)
Browse files Browse the repository at this point in the history
  • Loading branch information
nolanlawson authored and alice-werefox committed Apr 3, 2023
1 parent 9c480e6 commit 7baf1ae
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 5 deletions.
2 changes: 2 additions & 0 deletions src/intl/en-US.js
Original file line number Diff line number Diff line change
Expand Up @@ -495,6 +495,7 @@ export default {
other {video}
}: {description}`,
accountFollowedYou: '{name} followed you, {account}',
accountSignedUp: '{name} signed up, {account}',
reblogCountsHidden: 'Boost counts hidden',
favoriteCountsHidden: 'Favorite counts hidden',
rebloggedTimes: `Boosted {count, plural,
Expand All @@ -509,6 +510,7 @@ export default {
rebloggedYou: 'boosted your toot',
favoritedYou: 'favorited your toot',
followedYou: 'followed you',
signedUp: 'signed up',
posted: 'posted',
pollYouCreatedEnded: 'A poll you created has ended',
pollYouVotedEnded: 'A poll you voted on has ended',
Expand Down
17 changes: 13 additions & 4 deletions src/routes/_components/status/Notification.html
Original file line number Diff line number Diff line change
Expand Up @@ -58,19 +58,28 @@
account: ({ notification }) => notification.account,
accountId: ({ account }) => account.id,
notificationId: ({ notification }) => notification.id,
notificationType: ({ notification }) => notification.type,
status: ({ notification }) => notification.status,
statusId: ({ status }) => status && status.id,
uuid: ({ $currentInstance, timelineType, timelineValue, notificationId, statusId }) => (
createStatusOrNotificationUuid($currentInstance, timelineType, timelineValue, notificationId, statusId)
),
elementId: ({ uuid }) => uuid,
shortcutScope: ({ elementId }) => elementId,
ariaLabel: ({ status, account, $omitEmojiInDisplayNames }) => (
!status && formatIntl('intl.accountFollowedYou', {
ariaLabel: ({ status, account, $omitEmojiInDisplayNames, notificationType }) => {
if (status) {
return undefined // aria-label not needed if there's a status
}
const params = {
name: getAccountAccessibleName(account, $omitEmojiInDisplayNames),
account: `@${account.acct}`
})
),
}
if (notificationType === 'admin.sign_up') {
return formatIntl('intl.accountSignedUp', params)
} else { // 'follow'
return formatIntl('intl.accountFollowedYou', params)
}
},
className: ({ $underlineLinks }) => (classname(
'notification-article',
'shortcut-list-item',
Expand Down
4 changes: 4 additions & 0 deletions src/routes/_components/status/StatusHeader.html
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,8 @@
return '#fa-bar-chart'
} else if (notificationType === 'status') {
return '#fa-comment'
} else if (notificationType === 'admin.sign_up') {
return '#fa-user-plus'
}
return '#fa-star'
},
Expand All @@ -135,6 +137,8 @@
return 'intl.rebloggedYou'
} else if (notificationType === 'favourite') {
return 'intl.favoritedYou'
} else if (notificationType === 'admin.sign_up') {
return 'intl.signedUp'
} else if (notificationType === 'follow') {
return 'intl.followedYou'
} else if (notificationType === 'status') {
Expand Down
3 changes: 2 additions & 1 deletion src/service-worker.js
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,8 @@ async function showRichNotification (data, notification) {
const badge = '/icon-push-badge.png'

switch (notification.type) {
case 'follow': {
case 'follow':
case 'admin.sign_up': {
await self.registration.showNotification(data.title, {
badge,
icon,
Expand Down

0 comments on commit 7baf1ae

Please sign in to comment.