mirror of
https://gitlab.com/soapbox-pub/ditto.git
synced 2025-12-06 11:29:46 +00:00
renderWebPushNotification: fix account without display_name
This commit is contained in:
parent
7fbda4a56b
commit
bfe2c620e6
1 changed files with 8 additions and 6 deletions
|
|
@ -33,20 +33,22 @@ type MastodonNotification = NonNullable<Awaited<ReturnType<typeof renderNotifica
|
||||||
function renderTitle(notification: MastodonNotification): string {
|
function renderTitle(notification: MastodonNotification): string {
|
||||||
const { account } = notification;
|
const { account } = notification;
|
||||||
|
|
||||||
|
const name = account.display_name || account.username;
|
||||||
|
|
||||||
switch (notification.type) {
|
switch (notification.type) {
|
||||||
case 'ditto:name_grant':
|
case 'ditto:name_grant':
|
||||||
return `You were granted the name ${notification.name}`;
|
return `You were granted the name ${notification.name}`;
|
||||||
case 'ditto:zap':
|
case 'ditto:zap':
|
||||||
return `${account.display_name} zapped you ${notification.amount} sats`;
|
return `${name} zapped you ${notification.amount} sats`;
|
||||||
case 'pleroma:emoji_reaction':
|
case 'pleroma:emoji_reaction':
|
||||||
return `${account.display_name} reacted to your post`;
|
return `${name} reacted to your post`;
|
||||||
case 'favourite':
|
case 'favourite':
|
||||||
return `${account.display_name} liked your post`;
|
return `${name} liked your post`;
|
||||||
case 'mention':
|
case 'mention':
|
||||||
return `${account.display_name} mentioned you`;
|
return `${name} mentioned you`;
|
||||||
case 'reblog':
|
case 'reblog':
|
||||||
return `${account.display_name} reposted your post`;
|
return `${name} reposted your post`;
|
||||||
default:
|
default:
|
||||||
return account.display_name || account.username;
|
return name;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue