Skip to content

Commit 3a9830f

Browse files
authored
Fix stickers display text on room summary (#3221)
Signed-off-by: Marco Antonio Alvarez <[email protected]>
1 parent 344e07b commit 3a9830f

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

libraries/eventformatter/impl/src/main/kotlin/io/element/android/libraries/eventformatter/impl/DefaultRoomLastMessageFormatter.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ class DefaultRoomLastMessageFormatter @Inject constructor(
8585
}
8686
}
8787
is StickerContent -> {
88-
content.body
88+
prefixIfNeeded(sp.getString(CommonStrings.common_sticker) + " (" + content.body + ")", senderDisambiguatedDisplayName, isDmRoom)
8989
}
9090
is UnableToDecryptContent -> {
9191
val message = sp.getString(CommonStrings.common_waiting_for_decryption_key)

libraries/eventformatter/impl/src/test/kotlin/io/element/android/libraries/eventformatter/impl/DefaultRoomLastMessageFormatterTest.kt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,11 +105,12 @@ class DefaultRoomLastMessageFormatterTest {
105105
@Test
106106
@Config(qualifiers = "en")
107107
fun `Sticker content`() {
108-
val body = "body"
108+
val body = "a sticker body"
109109
val info = ImageInfo(null, null, null, null, null, null, null)
110110
val message = createRoomEvent(false, null, StickerContent(body, info, aMediaSource(url = "url")))
111111
val result = formatter.format(message, false)
112-
assertThat(result).isEqualTo(body)
112+
val expectedBody = someoneElseId.toString() + ": Sticker (a sticker body)"
113+
assertThat(result.toString()).isEqualTo(expectedBody)
113114
}
114115

115116
@Test

0 commit comments

Comments
 (0)