Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Only add a local receipt if it's after an existing receipt #3399

Merged

Conversation

andybalaam
Copy link
Contributor

@andybalaam andybalaam commented May 24, 2023

I suggest reviewing commit by commit.

This fixes a part that was missing from Attempt a potential workaround for stuck notifs - that PR inserted events that have arrived in the wrong order into (approx) the correct place in the timeline.

This change refuses to make a local echo receipt for a late-arriving event. We always consider synthesised receipts as the most important, so by making one for an old event, we were fooling ourselves into thinking newer stuff hadn't been read.

(This only applies when we don't have server support for recursive relations. When we do, we will simply trust the order of events from the server, so we won't consider timestamps - we'll just know the most recent event from the server is the most recent event, so it should get a receipt.)

Part of element-hq/element-web#10954


Here's what your changelog entry will look like:

馃悰 Bug Fixes

  • Only add a local receipt if it's after an existing receipt (#3399). Contributed by @andybalaam.

@andybalaam andybalaam force-pushed the andybalaam/only-add-local-receipt-if-after-existing branch from 9581fbb to cf6975a Compare May 24, 2023 07:23
@andybalaam andybalaam added the T-Defect Bugs, crashes, hangs, vulnerabilities, or other reported problems label May 24, 2023
@andybalaam andybalaam force-pushed the andybalaam/only-add-local-receipt-if-after-existing branch from cf6975a to 63c530d Compare May 25, 2023 01:55
@andybalaam andybalaam marked this pull request as ready for review May 25, 2023 01:55
@andybalaam andybalaam requested a review from a team as a code owner May 25, 2023 01:55
@andybalaam andybalaam marked this pull request as draft May 25, 2023 02:00
@andybalaam andybalaam changed the title Only add local receipt if it's after existing receipt Only add a local receipt if it's after an existing receipt May 25, 2023
@andybalaam andybalaam marked this pull request as ready for review May 25, 2023 03:17
@andybalaam andybalaam marked this pull request as draft May 25, 2023 03:19
@andybalaam andybalaam marked this pull request as ready for review May 25, 2023 03:19
Comment on lines +516 to +525
it("Creates a local echo receipt for new events", async () => {
// Assumption: no server side support because if we have it, events
// can only be added to the timeline after the thread has been
// initialised, and we are not properly initialising it here.
expect(Thread.hasServerSideSupport).toBe(FeatureSupport.None);

// Given a client WITH relations recursion support
const client = createClientWithEventMapper(
new Map([[Feature.RelationsRecursion, ServerSupport.Stable]]),
);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This could go to a beforeEach block because it is shared code.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor

@weeman1337 weeman1337 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good 馃憤

@andybalaam andybalaam added this pull request to the merge queue May 25, 2023
Merged via the queue into develop with commit 7ed14dc May 25, 2023
36 checks passed
@andybalaam andybalaam deleted the andybalaam/only-add-local-receipt-if-after-existing branch May 25, 2023 14:14
su-ex added a commit to SchildiChat/matrix-js-sdk that referenced this pull request Dec 13, 2023
* Ensure we do not add relations to the wrong timeline ([\matrix-org#3427](matrix-org#3427)). Fixes element-hq/element-web#25450 and element-hq/element-web#25494.
* Deprecate `QrCodeEvent`, `SasEvent` and `VerificationEvent` ([\matrix-org#3386](matrix-org#3386)).
* Move crypto classes into a separate namespace ([\matrix-org#3385](matrix-org#3385)).
* Mention deno support in the README ([\matrix-org#3417](matrix-org#3417)). Contributed by @sigmaSd.
* Mark room version 10 as safe ([\matrix-org#3425](matrix-org#3425)).
* Prioritise entirely supported flows for UIA ([\matrix-org#3402](matrix-org#3402)).
* Add methods to terminate idb worker ([\matrix-org#3362](matrix-org#3362)).
* Total summary count ([\matrix-org#3351](matrix-org#3351)). Contributed by @toger5.
* Audio concealment ([\matrix-org#3349](matrix-org#3349)). Contributed by @toger5.
* Correctly accumulate sync summaries. ([\matrix-org#3366](matrix-org#3366)). Fixes element-hq/element-web#23345.
* Keep measuring a call feed's volume after a stream replacement ([\matrix-org#3361](matrix-org#3361)). Fixes element-hq/element-call#1051.
* Element-R: Avoid uploading a new fallback key at every `/sync` ([\matrix-org#3338](matrix-org#3338)). Fixes element-hq/element-web#25215.
* Accumulate receipts for the main thread and unthreaded separately ([\matrix-org#3339](matrix-org#3339)). Fixes element-hq/element-web#24629.
* Remove spec non-compliant extended glob format ([\matrix-org#3423](matrix-org#3423)). Fixes element-hq/element-web#25474.
* Fix bug where original event was inserted into timeline instead of the edit event ([\matrix-org#3398](matrix-org#3398)). Contributed by @andybalaam.
* Only add a local receipt if it's after an existing receipt ([\matrix-org#3399](matrix-org#3399)). Contributed by @andybalaam.
* Attempt a potential workaround for stuck notifs ([\matrix-org#3384](matrix-org#3384)). Fixes element-hq/element-web#25406. Contributed by @andybalaam.
* Fix verification bug with `pendingEventOrdering: "chronological"` ([\matrix-org#3382](matrix-org#3382)).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
T-Defect Bugs, crashes, hangs, vulnerabilities, or other reported problems
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants