Skip to content

Commit

Permalink
fix(mls-migration): align with other clients on which proteus convers…
Browse files Browse the repository at this point in the history
…taion to migrate (WPB-12162) (#18387)
  • Loading branch information
V-Gira authored Nov 27, 2024
1 parent cde61b1 commit 583faa1
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/script/conversation/ConversationRepository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1620,8 +1620,10 @@ export class ConversationRepository {
),
);

const mostRecentlyUsedProteusConversation = proteusConversations.sort(
(a, b) => b.last_event_timestamp() - a.last_event_timestamp(),
// In the event that multiple 1:1 Proteus conversations exist, we migrate the one with the lowest id
// See https://wearezeta.atlassian.net/wiki/spaces/ENGINEERIN/pages/1344602120/Use+case+multiple+1+1+conversation+in+teams+Proteus
const proteusConversationToBeKept = proteusConversations.sort((a, b) =>
a.qualifiedId.id.localeCompare(b.qualifiedId.id),
)[0];

// Before we delete the proteus 1:1 conversation, we need to make sure all the local properties are also migrated
Expand All @@ -1638,7 +1640,7 @@ export class ConversationRepository {
mutedTimestamp,
status,
verification_state,
} = mostRecentlyUsedProteusConversation;
} = proteusConversationToBeKept;

const updates: Partial<Record<keyof Conversation, any>> = {
archivedState: archivedState(),
Expand Down

0 comments on commit 583faa1

Please sign in to comment.