Skip to content

Commit

Permalink
fix: rely on remote conversation for read receipt settings [WPB-11212] (
Browse files Browse the repository at this point in the history
#18206)

* fix: rely on remote conversation for read receipt settings

* update tests
  • Loading branch information
V-Gira authored Oct 25, 2024
1 parent cd3f28b commit fb69ac9
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
7 changes: 4 additions & 3 deletions src/script/conversation/ConversationMapper.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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', () => {
Expand Down
4 changes: 0 additions & 4 deletions src/script/conversation/ConversationMapper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit fb69ac9

Please sign in to comment.