1
0
mirror of https://github.com/matrix-org/matrix-js-sdk.git synced 2025-07-30 04:23:07 +03:00

Ensure we don't overinflate the total notification count (#3634)

* Ensure we don't overinflate the total notification count

By correctly comparing push rules before & after decryption

* DRY the code

* Testsssss

* Update tests
This commit is contained in:
Michael Telatynski
2023-07-28 16:05:11 +01:00
committed by GitHub
parent 615f7f9e72
commit fd0c4a7f56
6 changed files with 80 additions and 57 deletions

View File

@ -303,8 +303,13 @@ describe("EventTimelineSet", () => {
messageEventIsDecryptionFailureSpy.mockReturnValue(true);
replyEventIsDecryptionFailureSpy.mockReturnValue(true);
messageEvent.emit(MatrixEventEvent.Decrypted, messageEvent);
replyEvent.emit(MatrixEventEvent.Decrypted, replyEvent);
messageEvent.emit(
MatrixEventEvent.Decrypted,
messageEvent,
undefined,
messageEvent.getPushDetails(),
);
replyEvent.emit(MatrixEventEvent.Decrypted, replyEvent, undefined, replyEvent.getPushDetails());
// simulate decryption
messageEventIsDecryptionFailureSpy.mockReturnValue(false);
@ -313,8 +318,13 @@ describe("EventTimelineSet", () => {
messageEventShouldAttemptDecryptionSpy.mockReturnValue(false);
replyEventShouldAttemptDecryptionSpy.mockReturnValue(false);
messageEvent.emit(MatrixEventEvent.Decrypted, messageEvent);
replyEvent.emit(MatrixEventEvent.Decrypted, replyEvent);
messageEvent.emit(
MatrixEventEvent.Decrypted,
messageEvent,
undefined,
messageEvent.getPushDetails(),
);
replyEvent.emit(MatrixEventEvent.Decrypted, replyEvent, undefined, replyEvent.getPushDetails());
});
itShouldReturnTheRelatedEvents();