Skip to content
Draft
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
Original file line number Diff line number Diff line change
Expand Up @@ -687,7 +687,8 @@ class OfflineFirstChatRepository @Inject constructor(
when (messageJson.systemMessageType) {
ChatMessage.SystemMessageType.REACTION,
ChatMessage.SystemMessageType.REACTION_REVOKED,
ChatMessage.SystemMessageType.REACTION_DELETED,
ChatMessage.SystemMessageType.REACTION_DELETED -> {
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

this will completely ignore processing of reactions that were done on other clients

ChatMessage.SystemMessageType.MESSAGE_DELETED,
ChatMessage.SystemMessageType.POLL_VOTED,
ChatMessage.SystemMessageType.MESSAGE_EDITED -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,11 +144,13 @@ class ReactionsRepositoryImpl @Inject constructor(private val ncApi: NcApi, priv
message.reactionsSelf = ArrayList()
}

var amount = message.reactions!![emoji]
if (amount == null) {
amount = 0
val currentEmojiCount = message.reactions!![emoji] ?: 0
val newEmojiCount = currentEmojiCount - 1
if (newEmojiCount <= 0) {
message.reactions!!.remove(emoji)
} else {
message.reactions!![emoji] = newEmojiCount
}
message.reactions!![emoji] = amount - 1
message.reactionsSelf!!.remove(emoji)

// 3. Call DAO again, to update the singular ChatMessageEntity with params
Expand Down
Loading