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) (#18392)

Co-authored-by: Virgile <[email protected]>
  • Loading branch information
otto-the-bot and V-Gira authored Nov 27, 2024
1 parent 5bd85e1 commit 3e58121
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 @@ -1634,8 +1634,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 @@ -1652,7 +1654,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 3e58121

Please sign in to comment.