Merge pull request #3503 from element-hq/bma/invitationWithSender

Include inviter in the notification for invitation
This commit is contained in:
Benoit Marty 2024-09-24 09:40:07 +02:00 committed by GitHub
commit 12fa376649
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 208 additions and 150 deletions

View file

@ -112,6 +112,7 @@ class DefaultNotifiableEventResolver @Inject constructor(
)
}
is NotificationContent.Invite -> {
val senderDisambiguatedDisplayName = getDisambiguatedDisplayName(content.senderId)
InviteNotifiableEvent(
sessionId = userId,
roomId = roomId,
@ -124,8 +125,7 @@ class DefaultNotifiableEventResolver @Inject constructor(
soundName = null,
isRedacted = false,
isUpdated = false,
// TODO We could use the senderId here
description = descriptionFromRoomMembershipInvite(isDirect),
description = descriptionFromRoomMembershipInvite(senderDisambiguatedDisplayName, isDirect),
// TODO check if type is needed anymore
type = null,
// TODO check if title is needed anymore
@ -278,12 +278,13 @@ class DefaultNotifiableEventResolver @Inject constructor(
}
private fun descriptionFromRoomMembershipInvite(
senderDisambiguatedDisplayName: String,
isDirectRoom: Boolean
): String {
return if (isDirectRoom) {
stringProvider.getString(R.string.notification_invite_body)
stringProvider.getString(R.string.notification_invite_body_with_sender, senderDisambiguatedDisplayName)
} else {
stringProvider.getString(R.string.notification_room_invite_body)
stringProvider.getString(R.string.notification_room_invite_body_with_sender, senderDisambiguatedDisplayName)
}
}