Disambiguate display name in notifications #2224
This commit is contained in:
parent
f88d96fbc5
commit
0d35e60dac
6 changed files with 93 additions and 5 deletions
|
|
@ -91,7 +91,8 @@ class NotifiableEventResolver @Inject constructor(
|
|||
): NotifiableEvent? {
|
||||
return when (val content = this.content) {
|
||||
is NotificationContent.MessageLike.RoomMessage -> {
|
||||
val messageBody = descriptionFromMessageContent(content, senderDisplayName ?: content.senderId.value)
|
||||
val senderName = getSenderName(content.senderId)
|
||||
val messageBody = descriptionFromMessageContent(content, senderName)
|
||||
val notificationBody = if (hasMention) {
|
||||
stringProvider.getString(R.string.notification_mentioned_you_body, messageBody)
|
||||
} else {
|
||||
|
|
@ -104,7 +105,7 @@ class NotifiableEventResolver @Inject constructor(
|
|||
eventId = eventId,
|
||||
noisy = isNoisy,
|
||||
timestamp = this.timestamp,
|
||||
senderName = senderDisplayName,
|
||||
senderName = senderName,
|
||||
body = notificationBody,
|
||||
imageUriString = fetchImageIfPresent(client)?.toString(),
|
||||
roomName = roomDisplayName,
|
||||
|
|
@ -161,7 +162,7 @@ class NotifiableEventResolver @Inject constructor(
|
|||
eventId = eventId,
|
||||
noisy = isNoisy,
|
||||
timestamp = this.timestamp,
|
||||
senderName = senderDisplayName,
|
||||
senderName = getSenderName(content.senderId),
|
||||
body = stringProvider.getString(CommonStrings.common_poll_summary, content.question),
|
||||
imageUriString = null,
|
||||
roomName = roomDisplayName,
|
||||
|
|
|
|||
|
|
@ -527,6 +527,7 @@ class NotifiableEventResolverTest {
|
|||
roomId = A_ROOM_ID,
|
||||
senderAvatarUrl = null,
|
||||
senderDisplayName = "Bob",
|
||||
senderIsNameAmbiguous = false,
|
||||
roomAvatarUrl = null,
|
||||
roomDisplayName = null,
|
||||
isDirect = isDirect,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue