Skip to content
This repository has been archived by the owner on Sep 11, 2024. It is now read-only.

Improve room safety in the new room list #4905

Merged
merged 7 commits into from
Jul 7, 2020

Conversation

turt2live
Copy link
Member

@turt2live turt2live commented Jul 6, 2020

For element-hq/element-web#13635
For element-hq/element-web#14035 (partially)
Fixes element-hq/element-web#14314

Apologies for the somewhat difficult review here. The commits are a bit verbose and the diff is complicated.

Cases resolved:

  • Rooms going missing when the sticky room changes
  • Rooms duplicating between lists, or rooms not jumping to new lists when they should

Dev note: this is removed in a later commit
Plus a bunch of logging.

This fixes a case where switching rooms would cause the last room you were on to disappear due to an optimization where known NewRoom fires would be translated to tag change fires, which wouldn't re-add the room to the underlying tag algorithm.

By tracking the last sticky room, we can identify when we're about to do this and avoid it. 

This commit also adds a check to ensure that we have the latest reference of a room stored as rooms changing from invite -> join change references.

This commit additionally updates the PossibleTagChange handling to be faster and smarter, leading to a more stable generation of the room list. We convert the update cause to a Timeline update in order to indicate it is a change within the same tag rather than having to jump tags. This also means that PossibleTagChange should no longer make it as far as the underlying algorithm.

New logging has also been added to aid debugging.
This fixes a case where a user accepts an invite, which causes a tag change, but the room stays stuck in the invites list. The tag change additionally gets swallowed when the user moves away, causing the room to get lost. 

By moving it when we see it, potentially during a sticky room change itself (though extremely rare), we avoid having the room get lost in the wrong lists. A side effect of this is that accepting an invite puts it at the top of the tag it's going to (usually untagged), however this feels like the best option for the user.

A rare case of a tag change happening during a sticky room change is when a leave event comes in for the sticky room, but because it's come through as a tag change it can get swallowed. If it does get swallowed and the user clicks away, the tag change will happen when the room is re-introduced to the list (fake NewRoom event).
@turt2live turt2live force-pushed the travis/room-list/room-safety branch from 86f3f5e to 8739e2f Compare July 7, 2020 02:12
@turt2live turt2live marked this pull request as ready for review July 7, 2020 02:14
@turt2live turt2live requested a review from a team July 7, 2020 02:24
Copy link
Collaborator

@jryans jryans left a comment

Choose a reason for hiding this comment

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

I believe it all makes sense to me, thanks!

@turt2live turt2live merged commit 7173ea7 into develop Jul 7, 2020
@turt2live turt2live deleted the travis/room-list/room-safety branch July 7, 2020 13:00
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

New room list: Rooms go missing sometimes (lock breaking + sticky mishandling)
2 participants