-
Notifications
You must be signed in to change notification settings - Fork 232
Properly format lastMessage when it belongs to a poll. #1387
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## develop #1387 +/- ##
===========================================
+ Coverage 57.97% 57.99% +0.01%
===========================================
Files 1126 1126
Lines 29794 29804 +10
Branches 6052 6052
===========================================
+ Hits 17274 17285 +11
Misses 9931 9931
+ Partials 2589 2588 -1
☔ View full report in Codecov by Sentry. |
📱 Scan the QR code below to install the build (arm64 only) for this PR. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks.
@@ -95,7 +95,9 @@ class DefaultRoomLastMessageFormatter @Inject constructor( | |||
is StateContent -> { | |||
stateContentFormatter.format(content, senderDisplayName, isOutgoing, RenderingMode.RoomList) | |||
} | |||
is PollContent, // TODO Polls: handle last message | |||
is PollContent -> { | |||
prefixIfNeeded(content.question, senderDisplayName, isDmRoom) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't we want to prefix the question with something like "Poll: ", or even better display a picto?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice idea, forwarded the question to design: element-hq/element-meta#2048 (comment)
Not sure though how easy it is to include an icon/image here with the current code that handle the last messages.
726b9e3
to
4996643
Compare
Prefixed summary with "Poll: " and added unit tests. |
4996643
to
aeecd19
Compare
@@ -58,6 +59,7 @@ import org.robolectric.RobolectricTestRunner | |||
import org.robolectric.RuntimeEnvironment | |||
import org.robolectric.annotation.Config | |||
|
|||
@Suppress("LargeClass") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@bmarty I had to add this, is it ok?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, thanks!
Kudos, SonarCloud Quality Gate passed!
|
val pollContent = aPollContent() | ||
|
||
val mineContentEvent = createRoomEvent(sentByYou = true, senderDisplayName = "Alice", content = pollContent) | ||
Truth.assertThat(formatter.format(mineContentEvent, false).toString()).isEqualTo("Alice: Poll: Do you like polls?") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for adding tests. At some point we should revisit the last message rendering when it's sent by the current user. WhatsApp prefixes by You:
in groups, nothing in DM, and on Element Android we just omit the sender name (IIRC, not 100% sure)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
- Enables polls in room summaries from #1387 - Accommodates a few breaking changes
- Enables polls in room summaries from #1387 - Accommodates a few breaking changes
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: matrix-org/matrix-rust-sdk#2580