Skip to content
Snippets Groups Projects
Commit c4d81a35 authored by Pierre Nicolas's avatar Pierre Nicolas :joy:
Browse files

conversation: use reactions observable instead of risky mutable list

GitLab: #1235

Change-Id: I292b95a8653652270f31fe7f48f2b495720f15b5
parent 527cf61e
No related branches found
No related tags found
No related merge requests found
......@@ -471,11 +471,24 @@ class ConversationPresenter @Inject constructor(
view!!.shareText(interaction.body ?: return)
}
/**
* Remove reaction (emoji)
* Remove a reaction with git system consists in creating an "edit" interaction with empty body.
* @param interaction to clean from reaction
*/
fun removeReaction(interaction: Interaction) {
val conversation = mConversation ?: return
interaction.reactions.filter { it.author == myId }.forEach {
accountService.editConversationMessage(conversation.accountId, conversation.uri, "", it.messageId!!)
}
// User can only remove his reactions.
mCompositeDisposable.add(interaction.reactionObservable
.firstOrError()
.subscribe { interactionList ->
interactionList.filter { it.author == myId }.forEach { interaction ->
accountService.editConversationMessage(
conversation.accountId, conversation.uri, "", interaction.messageId!!
)
}
}
)
}
fun editMessage(accountId: String, conversationUri: Uri, messageId: String, newMessage: String) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment