forked from GitHub-Mirror/riotX-android
Do not send edition if text is identical
This commit is contained in:
parent
d613abf4b4
commit
7e8cd07e1e
@ -232,8 +232,17 @@ class RoomDetailViewModel @AssistedInject constructor(@Assisted initialState: Ro
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
SendMode.EDIT -> {
|
SendMode.EDIT -> {
|
||||||
|
val messageContent: MessageContent? =
|
||||||
|
state.selectedEvent?.annotations?.editSummary?.aggregatedContent.toModel()
|
||||||
|
?: state.selectedEvent?.root?.getClearContent().toModel()
|
||||||
|
val nonFormattedBody = messageContent?.body ?: ""
|
||||||
|
|
||||||
|
if (nonFormattedBody != action.text) {
|
||||||
room.editTextMessage(state.selectedEvent?.root?.eventId
|
room.editTextMessage(state.selectedEvent?.root?.eventId
|
||||||
?: "", action.text, action.autoMarkdown)
|
?: "", action.text, action.autoMarkdown)
|
||||||
|
} else {
|
||||||
|
Timber.w("Same message content, do not send edition")
|
||||||
|
}
|
||||||
setState {
|
setState {
|
||||||
copy(
|
copy(
|
||||||
sendMode = SendMode.REGULAR,
|
sendMode = SendMode.REGULAR,
|
||||||
@ -244,7 +253,7 @@ class RoomDetailViewModel @AssistedInject constructor(@Assisted initialState: Ro
|
|||||||
}
|
}
|
||||||
SendMode.QUOTE -> {
|
SendMode.QUOTE -> {
|
||||||
val messageContent: MessageContent? =
|
val messageContent: MessageContent? =
|
||||||
state.selectedEvent?.annotations?.editSummary?.aggregatedContent?.toModel()
|
state.selectedEvent?.annotations?.editSummary?.aggregatedContent.toModel()
|
||||||
?: state.selectedEvent?.root?.getClearContent().toModel()
|
?: state.selectedEvent?.root?.getClearContent().toModel()
|
||||||
val textMsg = messageContent?.body
|
val textMsg = messageContent?.body
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user