Properly format lastMessage when it belongs to a poll. (#1387)

Takes care of properly formatting a room's last message when it belongs to a poll.

NB: Polls still aren't exposed as a room's `last_message` from the rust SDK, so this code won't actually run yet. This will happen after integrating rust SDK version 0.1.57 which includes: https://github.com/matrix-org/matrix-rust-sdk/pull/2580
This commit is contained in:
Marco Romano 2023-09-21 15:20:15 +02:00 committed by GitHub
parent a534b1fa6d
commit 837443c690
4 changed files with 50 additions and 3 deletions

View file

@ -95,7 +95,10 @@ class DefaultRoomLastMessageFormatter @Inject constructor(
is StateContent -> {
stateContentFormatter.format(content, senderDisplayName, isOutgoing, RenderingMode.RoomList)
}
is PollContent, // TODO Polls: handle last message
is PollContent -> {
val message = sp.getString(CommonStrings.common_poll_summary, content.question)
prefixIfNeeded(message, senderDisplayName, isDmRoom)
}
is FailedToParseMessageLikeContent, is FailedToParseStateContent, is UnknownContent -> {
prefixIfNeeded(sp.getString(CommonStrings.common_unsupported_event), senderDisplayName, isDmRoom)
}