Skip to content

Commit

Permalink
refactor: move group establishment part to core
Browse files Browse the repository at this point in the history
  • Loading branch information
PatrykBuniX committed Sep 4, 2023
1 parent 4e95bf7 commit 13eeecd
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 21 deletions.
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"@datadog/browser-rum": "^4.47.0",
"@emotion/react": "11.11.1",
"@wireapp/avs": "9.3.7",
"@wireapp/core": "41.7.0",
"@wireapp/core": "file:.yalc/@wireapp/core",
"@wireapp/lru-cache": "3.8.1",
"@wireapp/react-ui-kit": "9.9.0",
"@wireapp/store-engine-dexie": "2.1.3",
Expand Down Expand Up @@ -189,6 +189,7 @@
"configure": "copy-config",
"deploy": "yarn build:prod && eb deploy",
"dev": "yarn start",
"dev:elna": "PORT=8082 FEDERATION=elna FEATURE_ENABLE_FEDERATION=true URL_ACCOUNT_BASE=https://account.elna.wire.link BACKEND_REST=https://nginz-https.elna.wire.link BACKEND_WS=wss://nginz-ssl.elna.wire.link FEATURE_CHECK_CONSENT=false yarn start",
"docker": "node ./bin/push_docker.js",
"zip": "node ./bin/zip.js",
"fix": "yarn fix:other && yarn fix:code",
Expand Down
19 changes: 3 additions & 16 deletions src/script/conversation/ConversationRepository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1547,25 +1547,12 @@ export class ConversationRepository {
throw new Error('Conversation service is not available!');
}

const {groupId, qualifiedId} = mlsConversation;

//if epoch is higher that 0 it means that the group is already established, we have to join with external commit
if (mlsConversation.epoch > 0) {
await conversationService.joinByExternalCommit(qualifiedId);
return mlsConversation;
}

const selfUserId = selfUser.qualifiedId;

//if it's not established, establish it and add the other user to the group
await conversationService.establishMLS1to1Conversation(
groupId,
{client: this.core.clientId, user: selfUserId},
const {members, epoch} = await conversationService.establishMLS1to1Conversation(
mlsConversation.groupId,
{client: this.core.clientId, user: selfUser.qualifiedId},
otherUserId,
);

//refetch the conversation to get the letest epoch and updated participants list
const {members, epoch} = await this.conversationService.getMLS1to1Conversation(otherUserId);
ConversationMapper.updateProperties(mlsConversation, {participating_user_ids: members.others, epoch});
await this.updateParticipatingUserEntities(mlsConversation);
return mlsConversation;
Expand Down
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -5300,9 +5300,9 @@ __metadata:
languageName: node
linkType: hard

"@wireapp/core@npm:41.7.0":
"@wireapp/core@file:.yalc/@wireapp/core::locator=wire-webapp%40workspace%3A.":
version: 41.7.0
resolution: "@wireapp/core@npm:41.7.0"
resolution: "@wireapp/core@file:.yalc/@wireapp/core#.yalc/@wireapp/core::hash=a01ca9&locator=wire-webapp%40workspace%3A."
dependencies:
"@wireapp/api-client": ^25.4.0
"@wireapp/commons": ^5.1.0
Expand All @@ -5321,7 +5321,7 @@ __metadata:
logdown: 3.3.1
long: ^5.2.0
uuidjs: 4.2.13
checksum: 75271b475496cb706f1c2239027e0899c4219317060f10cb776550b9c973e59ae9bd8cd967a4a1f105cdb357c4ccb867f8f20807358137df3e1028b1ecad6ceb
checksum: 79091a067ec03b13baf2d23b3f9c309affae693fb2bff2dce4179c88cc69e1b903059c4187000b900d1c8e6187555818c582be84d40dfb5e76c4212788531318
languageName: node
linkType: hard

Expand Down Expand Up @@ -18478,7 +18478,7 @@ __metadata:
"@types/webpack-env": 1.18.1
"@wireapp/avs": 9.3.7
"@wireapp/copy-config": 2.1.2
"@wireapp/core": 41.7.0
"@wireapp/core": "file:.yalc/@wireapp/core"
"@wireapp/eslint-config": 3.0.1
"@wireapp/lru-cache": 3.8.1
"@wireapp/prettier-config": 0.6.0
Expand Down

0 comments on commit 13eeecd

Please sign in to comment.