Skip to content

Commit 2cd2d82

Browse files
V-Giraotto-the-botthisisamir98
authored
fix: Allow personal users to create mls clients (WPB-17396) (#19053) (#19054) (#19523)
* fix: Allow personal users to create mls clients (WPB-17396) * cleanup * refactor * get common Co-authored-by: Otto the Bot <[email protected]> Co-authored-by: Amir Ghezelbash <[email protected]>
1 parent 3c32168 commit 2cd2d82

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

src/script/main/app.ts

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@
2222

2323
import {Context} from '@wireapp/api-client/lib/auth';
2424
import {ClientClassification, ClientType} from '@wireapp/api-client/lib/client/';
25+
import {FEATURE_KEY, FeatureList} from '@wireapp/api-client/lib/team';
26+
import {QualifiedId} from '@wireapp/api-client/lib/user';
2527
import {EVENTS as CoreEvents} from '@wireapp/core/lib/Account';
2628
import {MLSServiceEvents} from '@wireapp/core/lib/messagingProtocols/mls';
2729
import {amplify} from 'amplify';
@@ -427,7 +429,19 @@ export class App {
427429
if (!localClient) {
428430
throw new ClientError(CLIENT_ERROR_TYPE.NO_VALID_CLIENT, 'Client has been deleted on backend');
429431
}
430-
const {features: teamFeatures, members: teamMembers} = await teamRepository.initTeam(selfUser.teamId);
432+
433+
let teamFeatures: FeatureList = {};
434+
let teamMembers: QualifiedId[] = [];
435+
436+
if (selfUser.teamId) {
437+
const {features, members} = await teamRepository.initTeam(selfUser.teamId);
438+
teamFeatures = features;
439+
teamMembers = members;
440+
} else {
441+
const commonFeatures = (await this.core.service?.team.getCommonFeatureConfig()) ?? {};
442+
teamFeatures = {mls: commonFeatures[FEATURE_KEY.MLS]};
443+
}
444+
431445
try {
432446
await this.core.initClient(localClient, getClientMLSConfig(teamFeatures));
433447
} catch (error) {

0 commit comments

Comments
 (0)