From fb69ac9892b9ae90bca4cf2ba43ea54067ded5ee Mon Sep 17 00:00:00 2001 From: Virgile <78490891+V-Gira@users.noreply.github.com> Date: Fri, 25 Oct 2024 13:01:58 +0200 Subject: [PATCH] fix: rely on remote conversation for read receipt settings [WPB-11212] (#18206) * fix: rely on remote conversation for read receipt settings * update tests --- src/script/conversation/ConversationMapper.test.ts | 7 ++++--- src/script/conversation/ConversationMapper.ts | 4 ---- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/src/script/conversation/ConversationMapper.test.ts b/src/script/conversation/ConversationMapper.test.ts index 3b84b9854b9..923de85cd50 100644 --- a/src/script/conversation/ConversationMapper.test.ts +++ b/src/script/conversation/ConversationMapper.test.ts @@ -694,15 +694,16 @@ describe('ConversationMapper', () => { expect(merged_conversation.last_server_timestamp).toBe(localData.last_event_timestamp); }); - it('prefers local data over remote data when mapping the read receipts value', () => { + it('prefers remote data over remote data when mapping the read receipts value', () => { const localReceiptMode = 0; - const [localData, remoteData] = getDataWithReadReceiptMode(localReceiptMode, 1); + const remoteReceiptMode = 1; + const [localData, remoteData] = getDataWithReadReceiptMode(localReceiptMode, remoteReceiptMode); const [mergedConversation] = ConversationMapper.mergeConversations( [localData] as ConversationDatabaseData[], {found: [remoteData]} as RemoteConversations, ); - expect(mergedConversation.receipt_mode).toBe(localReceiptMode); + expect(mergedConversation.receipt_mode).toBe(remoteReceiptMode); }); it('uses the remote receipt mode when there is no local receipt mode', () => { diff --git a/src/script/conversation/ConversationMapper.ts b/src/script/conversation/ConversationMapper.ts index 30d61e94fc0..bd46b9436a0 100644 --- a/src/script/conversation/ConversationMapper.ts +++ b/src/script/conversation/ConversationMapper.ts @@ -429,10 +429,6 @@ export class ConversationMapper { } }); - if (typeof localConversationData.receipt_mode === 'number') { - updates.receipt_mode = localConversationData.receipt_mode; - } - const mergedConversation: ConversationDatabaseData = {...localConversationData, ...updates}; const isGroup = type === CONVERSATION_TYPE.REGULAR;