@wireapp/core 41.4.1 → 41.4.2
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.
|
@@ -341,7 +341,7 @@ class ConversationService extends TypedEventEmitter_1.TypedEventEmitter {
|
|
|
341
341
|
const { qualified_id: qualifiedId, group_id: groupId, epoch } = remoteMlsConversation;
|
|
342
342
|
try {
|
|
343
343
|
const isEstablished = await this.isMLSConversationEstablished(groupId);
|
|
344
|
-
const doesEpochMatch = await this.matchesEpoch(groupId, epoch);
|
|
344
|
+
const doesEpochMatch = isEstablished && (await this.matchesEpoch(groupId, epoch));
|
|
345
345
|
//if conversation is not established or epoch does not match -> try to rejoin
|
|
346
346
|
if (!isEstablished || !doesEpochMatch) {
|
|
347
347
|
this.logger.log(`Conversation (id ${qualifiedId.id}) was not established or it's epoch number was out of date, joining via external commit`);
|
|
@@ -156,7 +156,7 @@ describe('ConversationService', () => {
|
|
|
156
156
|
});
|
|
157
157
|
});
|
|
158
158
|
});
|
|
159
|
-
describe('
|
|
159
|
+
describe('handleConversationsEpochMismatch', () => {
|
|
160
160
|
beforeEach(() => {
|
|
161
161
|
jest.clearAllMocks();
|
|
162
162
|
});
|
|
@@ -169,15 +169,13 @@ describe('ConversationService', () => {
|
|
|
169
169
|
};
|
|
170
170
|
};
|
|
171
171
|
it('re-joins multiple not-established conversations', async () => {
|
|
172
|
-
const [conversationService, { apiClient
|
|
172
|
+
const [conversationService, { apiClient }] = buildConversationService();
|
|
173
173
|
const remoteEpoch = 1;
|
|
174
|
-
const localEpoch = 0;
|
|
175
174
|
const mlsConversation1 = createConversation(remoteEpoch, 'conversation1');
|
|
176
175
|
const mlsConversation2 = createConversation(remoteEpoch, 'conversation2');
|
|
177
176
|
const mockedDBResponse = [mlsConversation1, mlsConversation2];
|
|
178
177
|
jest.spyOn(apiClient.api.conversation, 'getConversationList').mockResolvedValueOnce({ found: mockedDBResponse });
|
|
179
178
|
jest.spyOn(conversationService, 'isMLSConversationEstablished').mockResolvedValue(false);
|
|
180
|
-
jest.spyOn(mlsService, 'getEpoch').mockResolvedValue(localEpoch);
|
|
181
179
|
await conversationService.handleConversationsEpochMismatch();
|
|
182
180
|
expect(conversationService.joinByExternalCommit).toHaveBeenCalledWith(mlsConversation1.qualified_id);
|
|
183
181
|
expect(conversationService.joinByExternalCommit).toHaveBeenCalledWith(mlsConversation2.qualified_id);
|
package/package.json
CHANGED