Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(TeamRepository): Prevent removal of MLS from supported protocols if it was previously supported #18797

Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
always include mls if it is already in supported list
  • Loading branch information
thisisamir98 committed Feb 28, 2025
commit c1c6030ba5cff2749011a4e71407c1516d0380b6
6 changes: 6 additions & 0 deletions src/script/self/SelfRepository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -185,9 +185,15 @@ export class SelfRepository extends TypedEventEmitter<Events> {
const localSupportedProtocols = this.selfUser.supportedProtocols();

this.logger.info('Evaluating self supported protocols, currently supported protocols:', localSupportedProtocols);

const currentSelf = await this.selfService.getSelf([]);

const previousSupportedProtocols = currentSelf.supported_protocols;

const refreshedSupportedProtocols = await evaluateSelfSupportedProtocols(
this.teamRepository,
this.clientRepository,
previousSupportedProtocols,
);

if (!localSupportedProtocols) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ const isMLSSupported = async (
export const evaluateSelfSupportedProtocols = async (
teamHandler: SelfSupportedProtocolsTeamHandler,
selfClientsHandler: SelfSupportedProtocolsSelfClientsHandler,
previousSupportedProtocols: ConversationProtocol[] = [],
): Promise<ConversationProtocol[]> => {
const supportedProtocols: ConversationProtocol[] = [];

Expand All @@ -116,7 +117,7 @@ export const evaluateSelfSupportedProtocols = async (

const isMLSForced = await isMLSForcedWithoutMigration(teamHandler, selfClientsHandler);

if (isMLSProtocolSupported || isMLSForced) {
if (isMLSProtocolSupported || isMLSForced || previousSupportedProtocols.includes(ConversationProtocol.MLS)) {
supportedProtocols.push(ConversationProtocol.MLS);
}

Expand Down
Loading