Skip to content

Don't mark room as unread due to reactions #5846

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

Open
wants to merge 4 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog.d/5846.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Don't mark room as unread due to reactions
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,5 @@ object RoomSummaryConstants {
EventType.CALL_ANSWER,
EventType.ENCRYPTED,
EventType.STICKER,
EventType.REACTION
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would merge this PR if this was the only change (with the changelog). Let's do not touch DisplayableEventFormatter.kt and strings.xml, just in case this is added again (in the project or in a fork).

) + EventType.POLL_START + EventType.STATE_ROOM_BEACON_INFO
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
package im.vector.app.features.home.room.detail.timeline.format

import dagger.Lazy
import im.vector.app.EmojiSpanify
import im.vector.app.R
import im.vector.app.core.resources.ColorProvider
import im.vector.app.core.resources.StringProvider
Expand All @@ -32,7 +31,6 @@ import org.matrix.android.sdk.api.session.room.model.message.MessageContent
import org.matrix.android.sdk.api.session.room.model.message.MessagePollContent
import org.matrix.android.sdk.api.session.room.model.message.MessageTextContent
import org.matrix.android.sdk.api.session.room.model.message.MessageType
import org.matrix.android.sdk.api.session.room.model.relation.ReactionContent
import org.matrix.android.sdk.api.session.room.timeline.TimelineEvent
import org.matrix.android.sdk.api.session.room.timeline.getLastMessageContent
import org.matrix.android.sdk.api.session.room.timeline.getTextDisplayableContent
Expand All @@ -41,7 +39,6 @@ import javax.inject.Inject
class DisplayableEventFormatter @Inject constructor(
private val stringProvider: StringProvider,
private val colorProvider: ColorProvider,
private val emojiSpanify: EmojiSpanify,
private val noticeEventFormatter: NoticeEventFormatter,
private val htmlRenderer: Lazy<EventHtmlRenderer>
) {
Expand Down Expand Up @@ -103,12 +100,6 @@ class DisplayableEventFormatter @Inject constructor(
EventType.STICKER -> {
simpleFormat(senderName, stringProvider.getString(R.string.send_a_sticker), appendAuthor)
}
EventType.REACTION -> {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems to be unused after my changes.

timelineEvent.root.getClearContent().toModel<ReactionContent>()?.relatesTo?.let {
val emojiSpanned = emojiSpanify.spanify(stringProvider.getString(R.string.sent_a_reaction, it.key))
simpleFormat(senderName, emojiSpanned, appendAuthor)
} ?: span { }
}
EventType.KEY_VERIFICATION_CANCEL,
EventType.KEY_VERIFICATION_DONE -> {
// cancel and done can appear in timeline, so should have representation
Expand Down Expand Up @@ -214,11 +205,6 @@ class DisplayableEventFormatter @Inject constructor(
EventType.STICKER -> {
stringProvider.getString(R.string.send_a_sticker)
}
EventType.REACTION -> {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the formatThreadSummary() pair of the above deletion, I deleted it for consistency. But let me know if this is a bad idea.

event.getClearContent().toModel<ReactionContent>()?.relatesTo?.let {
emojiSpanify.spanify(stringProvider.getString(R.string.sent_a_reaction, it.key))
} ?: span { }
}
in EventType.POLL_START -> {
event.getClearContent().toModel<MessagePollContent>(catchError = true)?.pollCreationInfo?.question?.question
?: stringProvider.getString(R.string.sent_a_poll)
Expand Down
3 changes: 2 additions & 1 deletion vector/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2129,7 +2129,8 @@
<string name="sent_a_file">File</string>
<string name="send_a_sticker">Sticker</string>
<string name="sent_a_poll">Poll</string>
<string name="sent_a_reaction">Reacted with: %s</string>
<!-- TODO TO BE REMOVED -->
<string name="sent_a_reaction" tools:ignore="UnusedResources">Reacted with: %s</string>
<string name="sent_verification_conclusion">Verification Conclusion</string>
<string name="sent_location">Shared their location</string>
<string name="sent_live_location">Shared their live location</string>
Expand Down