enhance(backend): push notification for chat message

Resolve #15831
This commit is contained in:
syuilo 2025-04-15 18:27:45 +09:00
parent fff2783c1b
commit fc6037af46
7 changed files with 36 additions and 4 deletions

View file

@ -268,6 +268,24 @@ async function composeNotification(data: PushNotificationDataMap[keyof PushNotif
data,
renotify: true,
}];
case 'newChatMessage':
if (data.body.toRoom != null) {
return [`${data.body.toRoom.name}: ${getUserName(data.body.fromUser)}: ${data.body.text}`, {
icon: data.body.fromUser.avatarUrl,
badge: iconUrl('messages'),
tag: `chat:room:${data.body.toRoomId}`,
data,
renotify: true,
}];
} else {
return [`${getUserName(data.body.fromUser)}: ${data.body.text}`, {
icon: data.body.fromUser.avatarUrl,
badge: iconUrl('messages'),
tag: `chat:user:${data.body.fromUserId}`,
data,
renotify: true,
}];
}
default:
return null;
}