This repository has been archived by the owner on Sep 11, 2024. It is now read-only.
Fix: prevent spurious notifications from indexer #4414
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes element-hq/element-web#12659
The problem was that
EventIndex
using an event mapper from the js-sdk to decrypt and createMatrixEvent
object, it was also causingEvent.decrypted
to be emitted on the client, triggering https://github.com/matrix-org/matrix-js-sdk/blob/1b8f6d173953ac49c3178456ecb587ccefeb0cd3/src/client.js#L353 to add push actions for e2ee events. The highlight count there should only be set if the event hasn't been read before, butRoom.hasUserReadEvent
assumes that the whole timeline between the m.read marker and the given event id is known, which is not the case for older events or even rooms of a previous room version, as the bug indicates. In this casehasUserReadEvent
returns false and the hightlight count is set, causing the badge.Ideally, we'd fill any gaps created by a limited sync and store them, and only from this create e2ee notifications. But right now we don't have a good way to do that. So the solution taken here is to further disconnect the
EventIndex
from everything else that listens to the js-sdk, and the disable remitting from the event to the client from events created in the indexer.