Fix 'Conversation label cannot be empty' error (#6823)

This happens when building a `ShortcutInfoCompat` in `DefaultNotificationConversationService.onSendMessage` when the provided room name is not null but it's empty.
This commit is contained in:
Jorge Martin Espinosa 2026-05-20 14:26:44 +02:00 committed by GitHub
parent 42c141109f
commit 64d9336901
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 7 additions and 6 deletions

View file

@ -571,7 +571,7 @@ class MessageComposerPresenter(
notificationConversationService.onSendMessage(
sessionId = room.sessionId,
roomId = roomInfo.id,
roomName = roomInfo.name ?: roomInfo.id.value,
roomName = roomInfo.name,
roomIsDirect = roomInfo.isDm,
roomAvatarUrl = roomInfo.avatarUrl ?: roomMembers.getDirectRoomMember(roomInfo = roomInfo, sessionId = room.sessionId)?.avatarUrl,
)

View file

@ -22,7 +22,7 @@ interface NotificationConversationService {
suspend fun onSendMessage(
sessionId: SessionId,
roomId: RoomId,
roomName: String,
roomName: String?,
roomIsDirect: Boolean,
roomAvatarUrl: String?,
)

View file

@ -76,7 +76,7 @@ class DefaultNotificationConversationService(
override suspend fun onSendMessage(
sessionId: SessionId,
roomId: RoomId,
roomName: String,
roomName: String?,
roomIsDirect: Boolean,
roomAvatarUrl: String?,
) {
@ -93,10 +93,11 @@ class DefaultNotificationConversationService(
val imageLoader = imageLoaderHolder.get(client)
val defaultShortcutIconSize = ShortcutManagerCompat.getIconMaxWidth(context)
val name = roomName?.takeIf { it.isNotBlank() } ?: roomId.value
val icon = bitmapLoader.getRoomBitmap(
avatarData = AvatarData(
id = roomId.value,
name = roomName,
name = name,
url = roomAvatarUrl,
size = AvatarSize.RoomDetailsHeader,
),
@ -105,7 +106,7 @@ class DefaultNotificationConversationService(
)?.let(IconCompat::createWithBitmap)
val shortcutInfo = ShortcutInfoCompat.Builder(context, createShortcutId(sessionId, roomId))
.setShortLabel(roomName)
.setShortLabel(name)
.setIcon(icon)
.setIntent(intentProvider.getViewRoomIntent(sessionId, roomId, threadId = null, eventId = null))
.setCategories(categories)

View file

@ -16,7 +16,7 @@ class FakeNotificationConversationService : NotificationConversationService {
override suspend fun onSendMessage(
sessionId: SessionId,
roomId: RoomId,
roomName: String,
roomName: String?,
roomIsDirect: Boolean,
roomAvatarUrl: String?,
) = Unit