Commit Graph

82 Commits

Author SHA1 Message Date
Travis Ralston
a5b4d4ba95 Include tag name when warning about rooms running off lists 2019-03-04 10:56:18 -07:00
Travis Ralston
7d9e58b3c3
Merge pull request #2735 from matrix-org/travis/duplicated-people
Don't duplicate direct chats from other tags
2019-03-04 10:34:32 -07:00
Travis Ralston
49f506cef4 More clearly fix issues with room insertion to lists
Instead of having a catch-all insert, try and fix the common cases with a bit more care.
2019-03-01 17:18:16 -07:00
Travis Ralston
43d099836b Always insert rooms into lists when they get lost
Room upgrades, direct chats, etc all end up being lost in these scenarios. Instead of losing them to the list, try and put them into a relevant spot of the list.

Fixes https://github.com/vector-im/riot-web/issues/9020
2019-03-01 15:48:10 -07:00
Travis Ralston
3c2403ca54 Don't duplicate direct chats from other tags
Fixes https://github.com/vector-im/riot-web/issues/8971
2019-03-01 15:29:24 -07:00
Travis Ralston
805676a511 Don't lose invites when multiple are pending 2019-02-28 14:03:28 -07:00
Travis Ralston
872cdaa9b3 Use the already available state for checking if custom tags are enabled 2019-02-28 14:03:28 -07:00
Travis Ralston
b1e16e9f49 Fix stacktrace when starting riot up with rooms
Settings can trigger before we're ready, so don't generate the room list. This also includes a comment to signify to future people that we need to track settings still.
2019-02-28 13:55:20 -07:00
Travis Ralston
a3342a5790 Standardize on "Category" being the canonical term for room list sections 2019-02-28 13:24:05 -07:00
Travis Ralston
bafe59fe28 Appease the linter 2019-02-27 18:29:48 -07:00
Travis Ralston
c908a6cf1e Move complex part of room sorting to a dedicated function
Pretty much cut/pasting it in, as there's not really a whole much to help make the code more understandable here.

This also includes a comment block longer than the code it describes in hopes it explains away the problem of understanding what it does.

Should fix https://github.com/vector-im/riot-web/issues/8861
2019-02-27 15:55:16 -07:00
Travis Ralston
2c2685a3ea
Merge pull request #2705 from matrix-org/travis/fix-monitored-settings
Use a global WatchManager for settings
2019-02-27 08:02:27 -07:00
Travis Ralston
143f218e08 Make sure direct chat invites are treated as invites
Fixes https://github.com/vector-im/riot-web/issues/8966

The DMRoomMap updates before we accept the invite, so make sure to check if it is an invite before checking if it is a direct chat.
2019-02-26 23:40:07 -07:00
Travis Ralston
93673eff12 Use a global WatchManager for settings
Fixes https://github.com/vector-im/riot-web/issues/8936

Watchers are now managed by the SettingsStore itself through a global/default watch manager. As per the included documentation, the watch manager dispatches updates to callbacks which are redirected by the SettingsStore for consumer safety.
2019-02-26 12:52:59 -07:00
Travis Ralston
3d152da822 Support custom tags in the new algorithm 2019-02-25 13:39:08 -07:00
Travis Ralston
e083d50e31 Merge branch 'develop' into travis/fix-invites 2019-02-25 12:41:19 -07:00
Travis Ralston
5f760fbf4a Change the room list algo to eagerly delete and carefully insert
Previously it made some complicated assumptions about the contexts it was called in (it generally assumed it just had to shuffle rooms between tags and didn't really handle new rooms very well).

The algorithm now eagerly tries to drop rooms from tags and carefully inserts them. The actual insertion logic is mostly untouched: the only part changed is how it handles failure to insert into tag. It shouldn't be possible for this algorithm to completely skip a room unless the tag is empty, so we special case that.

There are several TODO comments to be addressed here. Namely, it doesn't handle manually ordered tags (favourites, custom, etc) and doesn't check if tags are even enabled. Changes in this area are waiting for https://github.com/matrix-org/matrix-react-sdk/pull/2686 to land to take advantage of monitoring the settings flag for tags.
2019-02-24 19:45:23 -07:00
Travis Ralston
b0cc69bca9 Add an option to sort the room list by recents first
Fixes https://github.com/vector-im/riot-web/issues/8892
2019-02-22 17:09:07 -07:00
Travis Ralston
e7b3cbfdf4 Fix categorization of favourites and new rooms
New rooms (joined, invited, created, etc) were being ignored because they matched the check as soon as the iterator hit a non-recents section. This fixes the check to ensure there's a positive ID on the room being in the tag (or not, in the case of new rooms) before lying to the rest of the function.

Additionally, a fix for favourites has been included to stop the list expanding to fill the void - turns out it was inserting the room twice into the list, and this was breaking the tile rendering. The room sublist would allocate space for the tile, but React would prevent the tile from showing up because of duplicate keys.

Fixes https://github.com/vector-im/riot-web/issues/8868
Fixes https://github.com/vector-im/riot-web/issues/8857 correctly
2019-02-21 19:21:32 -07:00
Travis Ralston
d662dccfba Fix favourites losing rooms and sorting weirdly
By not flagging the room as inserted, we end up sorting it.

Fixes https://github.com/vector-im/riot-web/issues/8857
2019-02-21 09:17:35 -07:00
Travis Ralston
64103b7af4 More micro optimizations to make the hot paths faster 2019-02-19 15:15:39 -07:00
Travis Ralston
561d1f37ec Stick a couple micro optimizations into the setRoomCategory hot path 2019-02-19 14:56:56 -07:00
Travis Ralston
cb15bc968c Remove excessive dispatch binding 2019-02-15 23:41:48 -07:00
Travis Ralston
53fa59f5a4 Remove old debugging code
The algorithm is correctly applied when these are removed.
2019-02-15 23:40:23 -07:00
Travis Ralston
45a415f8bf Protection around lack of room for tests 2019-02-13 20:16:47 -07:00
Travis Ralston
a2a13636ed Don't blow up when rooms have no timelines 2019-02-13 20:02:18 -07:00
Travis Ralston
0c7e0a264b Inline documentation 2019-02-13 19:49:28 -07:00
Travis Ralston
b08ab6cd12 Fix boundary math calculations 2019-02-13 19:35:01 -07:00
Travis Ralston
c0b63f986f Implement a cache on _tsOfNewestEvent: ~75% improvement 2019-02-13 19:16:11 -07:00
Travis Ralston
52f48f7422 Order by timestamp within the categorized room lists
When we load the page, all encrypted events arrive well after we've generated our initial grouping which can cause them to jump to the top of their categories wrongly. For direct chats, this meant that people who don't have a lot of unread messages would see ancient rooms bubbling to the top for no reason after the page has loaded.

We still have to track when the last category change was (ie: when we switched from red -> grey) so that when the category doesn't exist in the list we can insert the room at the right place (the start of the last category when we switch beyond the order expected).
2019-02-13 18:19:18 -07:00
Travis Ralston
821b34b487 React to read receipt changes from ourselves
When a room is read on another device, it should be re-sorted
2019-02-13 17:03:27 -07:00
Travis Ralston
2eb80f793c Try to handle direct chats and tag changes
This is a very blunt approach in that it ignores the sticky room.
2019-02-13 14:22:00 -07:00
Travis Ralston
b741b76797 Handle joins/leaves safely 2019-02-13 14:08:19 -07:00
Travis Ralston
b6c1b50fd9 Early support for improved room algorithm
This changes the approach from regenerating every time there's a change to incrementally fixing the room lists. Additionally, this forces the pin options on for people and implements the sticky room behaviour.

Known bugs include newly joined rooms, invites, etc not sorting correctly.
2019-02-13 13:01:03 -07:00
Bruno Windels
e8533beafb guard custom tags with feature flag 2019-02-07 18:07:30 +00:00
Bruno Windels
3265fe394d don't filter out custom tags anymore 2019-02-05 17:35:05 +00:00
Travis Ralston
66cd8475b5 Don't reset cached room list values when they are falsey
`unread` and `unread-muted` store booleans in the cache, and can easily be `false`. Without this patch, both of those cached types would be cleared from the object where a later call to `getRoomState` would try and re-populate them. `getRoomState` is supposed to use the cache where possible to avoid making the more expensive calls required to calculate those booleans.

On my account in a test environment, this brings the `generateRoomLists` execution time down from ~250ms to just ~30ms. 

This still does not solve the whole issue, but should solve the more common case of performance woes for people.
2019-01-07 17:46:32 -07:00
Travis Ralston
8017f0a4a1 Merge remote-tracking branch 'origin/experimental' into travis/develop-for-real 2019-01-03 16:00:23 -07:00
David Baker
f928be6f59 Revert "Merge pull request #2395 from matrix-org/dbkr/merge_develop_experimental"
This reverts commit ad47144355.
2019-01-03 15:37:03 -07:00
David Baker
7d161de35b Partial merge of develop to experimental
Does not include #2336 as the file has been moved out from underneath it:
will do this separately
2019-01-03 15:02:58 +00:00
Bruno Windels
532fb6ea78 update comment as well 2018-12-17 13:58:36 +01:00
Bruno Windels
4fffb55cc5 ignore any unknown tags 2018-12-17 13:52:32 +01:00
Travis Ralston
216fc6412a Fix pinning of rooms without badges
Fixes https://github.com/vector-im/riot-web/issues/7723

This adds consideration for rooms that are "mentions only" (or "unread-muted" as internally referenced).
2018-12-05 13:52:27 -07:00
Travis Ralston
f9d5c11d8d Regenerate the room list when m.fully_read is issued
Not doing so results in the RoomListStore tracking stale data when the user reads messages on another device. The visual effect of this is rooms being incorrectly pinned in places they shouldn't be, such as the top of the list. This also fixes another visual bug where rooms don't move down once their timelines are read. This second issue is mot prominent when multiple rooms have been pinned to the top, and the middle one is read ahead of the others - it'll stick around until some other condition decides to wipe the room's cached state.

Fixes https://github.com/vector-im/riot-web/issues/7653
2018-11-04 19:47:24 -07:00
Travis Ralston
3960ae2fcd Add more commentary around how the roomCache works 2018-11-01 17:17:01 -06:00
Travis Ralston
a713cc5c52 Compare the right types of events 2018-11-01 17:07:05 -06:00
Travis Ralston
122868e32f Removing timing/performance tracking on room list store
This was used to verify the fix was actually making improvements and can be safely taken out.
2018-11-01 16:30:48 -06:00
Travis Ralston
0c7aadb92b Improve room list sort performance by caching common variables
This won't help much if the user is in a ton of highly active rooms, but for the most part this will help those in thousands of rooms, many of which are likely to be quiet. 

Fixes https://github.com/vector-im/riot-web/issues/7646
Fixes https://github.com/vector-im/riot-web/issues/7645 (due to timestamp ordering)
2018-11-01 16:28:13 -06:00
Travis Ralston
272acfa2f5 Appease the linter 2018-11-01 14:46:39 -06:00
Travis Ralston
5558b7a3b2 Avoid hitting the SettingsStore thousands of times when generating room lists
Should fix https://github.com/vector-im/riot-web/issues/7646 to some degree
2018-11-01 14:43:15 -06:00