Skip to content

Commit

Permalink
fix: Detect message edit and let the DB observer take care of handlin…
Browse files Browse the repository at this point in the history
…g them (#5651)
  • Loading branch information
atomrc committed Jan 18, 2019
1 parent cbd4a59 commit a2fa01e
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/script/conversation/ConversationRepository.js
Expand Up @@ -3013,12 +3013,19 @@ z.conversation.ConversationRepository = class ConversationRepository {
case z.event.Backend.CONVERSATION.RECEIPT_MODE_UPDATE:
return this._onReceiptModeChanged(conversationEntity, eventJson);

case z.event.Client.CONVERSATION.MESSAGE_ADD:
const isMessageEdit = !!eventJson.edited_time;
if (isMessageEdit) {
// in case of an edition, the DB listner will take care of updating the local entity
return {conversationEntity};
}
return this._addEventToConversation(conversationEntity, eventJson);

case z.event.Backend.CONVERSATION.MESSAGE_TIMER_UPDATE:
case z.event.Client.CONVERSATION.DELETE_EVERYWHERE:
case z.event.Client.CONVERSATION.INCOMING_MESSAGE_TOO_BIG:
case z.event.Client.CONVERSATION.KNOCK:
case z.event.Client.CONVERSATION.LOCATION:
case z.event.Client.CONVERSATION.MESSAGE_ADD:
case z.event.Client.CONVERSATION.MISSED_MESSAGES:
case z.event.Client.CONVERSATION.UNABLE_TO_DECRYPT:
case z.event.Client.CONVERSATION.VERIFICATION:
Expand Down

0 comments on commit a2fa01e

Please sign in to comment.