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

Make RoomListStore aware of Room.timeline events #1756

Merged
merged 3 commits into from
Feb 20, 2018

Conversation

lukebarnard1
Copy link
Contributor

@lukebarnard1 lukebarnard1 commented Feb 16, 2018

so that we can do reorderings of lists ordered by most recent event.

No optimisations here; we only update for timeline events
on live timelines that could update the "unread count".

Fixes element-hq/element-web#6132

so that we can do reorderings of lists ordered by most recent event.

No optimisations here; we only update for timeline events
on live timelines that could update the "unread count".
if (toStartOfTimeline) return;
if (!room) return;
if (data.timeline.getTimelineSet() !== room.getUnfilteredTimelineSet()) return;
this._delayedRefreshRoomList();
Copy link
Member

Choose a reason for hiding this comment

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

These checks seem to have disappeared, as well as the _delayedRefreshRoomList?

Copy link
Contributor Author

@lukebarnard1 lukebarnard1 Feb 16, 2018

Choose a reason for hiding this comment

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

So:

  • the _delayedRefreshRoomList is done when we get an update from RoomListStore;
  • the timeline set check I thought would be handle by isLiveEvent? Unless I've got that confused?
  • toStartOfTimeline this is handled by isLiveEvent, which includes !toStartOfTimeline.
  • !room nothing uses the room, so I'll remove it from the MatrixAction.

Copy link
Member

Choose a reason for hiding this comment

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

Ah right, OK. I think this almost all true apart from the timeline set check, where live timeline !== unfiltered timeline set. There are multiple timeline sets, the first is the unfiltered one (the normal one that isn't a search result). Each timeline set has many timelines, one of which is live. liveEvent is telling you if it's to the live timeline in a timeline set, not if it's to the timeline set you're interested in.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

So in theory we shouldn't get live events for search result or any other timeline set apart from the unfiltered one. We're not sure how true this is though. Investigation of exactly when Room.timeline is emitted will have to be done.

Copy link
Contributor Author

@lukebarnard1 lukebarnard1 Feb 19, 2018

Choose a reason for hiding this comment

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

Seemingly this isn't true, as @dbkr has said, each set (be it a room timeline, notification timeline, rooms timeline) has a live timeline, and the only way of us knowing which is the room's live timeline if by comparing references.

@dbkr dbkr assigned lukebarnard1 and unassigned dbkr Feb 16, 2018
@lukebarnard1 lukebarnard1 assigned dbkr and unassigned lukebarnard1 Feb 16, 2018
@dbkr dbkr assigned lukebarnard1 and unassigned dbkr Feb 16, 2018
Only do so for the live timeline of rooms.
@lukebarnard1 lukebarnard1 assigned dbkr and unassigned lukebarnard1 Feb 19, 2018
@dbkr dbkr merged commit fd90a8b into develop Feb 20, 2018
!payload.isLiveUnfilteredRoomTimelineEvent ||
!this._eventTriggersRecentReorder(payload.event)
) break;
this._generateRoomLists();
Copy link
Member

Choose a reason for hiding this comment

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

shouldn't _generateRoomLists have a ratelimiter on it? surely this is quite a heavy operation, and we shouldn't be doing it each and every time a live timeline event happens?

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.

3 participants