@wireapp/core 30.3.0 → 30.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -3,6 +3,17 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ # [30.4.0](https://github.com/wireapp/wire-web-packages/tree/main/packages/core/compare/@wireapp/core@30.3.0...@wireapp/core@30.4.0) (2022-09-07)
7
+
8
+
9
+ ### Features
10
+
11
+ * Update getAllParticipantsClients to use better endpoints without a hack ([#4379](https://github.com/wireapp/wire-web-packages/tree/main/packages/core/issues/4379)) ([f38258d](https://github.com/wireapp/wire-web-packages/tree/main/packages/core/commit/f38258db39e81c4b517126792aa6c605b1ea51c5))
12
+
13
+
14
+
15
+
16
+
6
17
  # [30.3.0](https://github.com/wireapp/wire-web-packages/tree/main/packages/core/compare/@wireapp/core@30.2.0...@wireapp/core@30.3.0) (2022-09-07)
7
18
 
8
19
 
package/package.json CHANGED
@@ -7,7 +7,7 @@
7
7
  "@otak/core-crypto": "0.3.0-es2017",
8
8
  "@types/long": "4.0.1",
9
9
  "@types/node": "~14",
10
- "@wireapp/api-client": "20.1.0",
10
+ "@wireapp/api-client": "20.2.0",
11
11
  "@wireapp/commons": "4.3.0",
12
12
  "@wireapp/cryptobox": "12.8.0",
13
13
  "@wireapp/store-engine-dexie": "1.6.10",
@@ -77,6 +77,6 @@
77
77
  "test:node": "nyc jasmine --config=jasmine.json",
78
78
  "watch": "tsc ---watch"
79
79
  },
80
- "version": "30.3.0",
81
- "gitHead": "0a4d4b6057006da93a731115ab02c9753b155127"
80
+ "version": "30.4.0",
81
+ "gitHead": "9df4ed23ee62258dac598e16e86ef037ee143f6e"
82
82
  }
@@ -92,10 +92,6 @@ export declare class ConversationService {
92
92
  })>;
93
93
  /**
94
94
  * Get a fresh list from backend of clients for all the participants of the conversation.
95
- * This is a hacky way of getting all the clients for a conversation.
96
- * The idea is to send an empty message to the backend to absolutely no users and let backend reply with a mismatch error.
97
- * We then get the missing members in the mismatch, that is our fresh list of participants' clients.
98
- *
99
95
  * @param {string} conversationId
100
96
  * @param {string} conversationDomain? - If given will send the message to the new qualified endpoint
101
97
  */
@@ -63,11 +63,10 @@ class ConversationService {
63
63
  * yourself in the list of users if you want to sync a message also to your
64
64
  * other clients.
65
65
  */
66
- return (conversation.members.others
66
+ return conversation.members.others
67
67
  .filter(member => !!member.qualified_id)
68
68
  .map(member => member.qualified_id)
69
- // TODO(Federation): Use 'domain' from 'conversation.members.self' when backend has it implemented
70
- .concat({ domain: this.apiClient.context.domain, id: conversation.members.self.id }));
69
+ .concat(conversation.members.self.qualified_id);
71
70
  }
72
71
  /**
73
72
  * Will generate a prekey bundle for specific users.
@@ -515,37 +514,18 @@ class ConversationService {
515
514
  }
516
515
  /**
517
516
  * Get a fresh list from backend of clients for all the participants of the conversation.
518
- * This is a hacky way of getting all the clients for a conversation.
519
- * The idea is to send an empty message to the backend to absolutely no users and let backend reply with a mismatch error.
520
- * We then get the missing members in the mismatch, that is our fresh list of participants' clients.
521
- *
522
517
  * @param {string} conversationId
523
518
  * @param {string} conversationDomain? - If given will send the message to the new qualified endpoint
524
519
  */
525
- getAllParticipantsClients(conversationId, conversationDomain) {
526
- const sendingClientId = this.apiClient.validatedClientId;
527
- const recipients = {};
528
- const text = new Uint8Array();
529
- return new Promise(async (resolve) => {
530
- const onClientMismatch = (mismatch) => {
531
- resolve(mismatch.missing);
532
- // When the mismatch happens, we ask the messageService to cancel the sending
533
- return false;
534
- };
535
- if (conversationDomain && this.config.useQualifiedIds) {
536
- await this.messageService.sendFederatedMessage(sendingClientId, recipients, text, {
537
- conversationId: { id: conversationId, domain: conversationDomain },
538
- onClientMismatch,
539
- reportMissing: true,
540
- });
541
- }
542
- else {
543
- await this.messageService.sendMessage(sendingClientId, recipients, text, {
544
- conversationId,
545
- onClientMismatch,
546
- });
547
- }
548
- });
520
+ async getAllParticipantsClients(conversationId, conversationDomain) {
521
+ const qualifiedMembers = await this.getConversationQualifiedMembers(conversationDomain ? { id: conversationId, domain: conversationDomain } : conversationId);
522
+ const allClients = await this.apiClient.api.user.postListClients({ qualified_users: qualifiedMembers });
523
+ const qualifiedUserClients = {};
524
+ Object.entries(allClients.qualified_user_map).map(([domain, userClientMap]) => Object.entries(userClientMap).map(async ([userId, clients]) => {
525
+ qualifiedUserClients[domain] || (qualifiedUserClients[domain] = {});
526
+ qualifiedUserClients[domain][userId] = clients.map(client => client.id);
527
+ }));
528
+ return qualifiedUserClients;
549
529
  }
550
530
  async deleteMessageLocal(conversationId, messageIdToHide, sendAsProtobuf, conversationDomain) {
551
531
  const messageId = MessageBuilder_1.MessageBuilder.createId();