Commit Graph

331 Commits

Author SHA1 Message Date
David Baker
d7509dd4c4 comment consistency 2019-04-08 19:12:04 +01:00
David Baker
670f6e4f99 Simplify settings dialog CSS
Stop the settings dialogs from requiring special styles on the
mx_Dialog which required passing in a classname from anywhere the
settings dialogs were opened (although this still requires
static=true). Some of the things have now been adopted for all dialogs
(border-radius), others have been moved to within the dialog content.
2019-04-08 16:48:42 +01:00
Travis Ralston
f2b7042a33 misc cleanup 2019-04-04 09:30:15 -06:00
Travis Ralston
10369170ed Use a static prop on Stickerpicker to track the current widget 2019-04-03 17:16:56 -06:00
Travis Ralston
51750cf153 General cleanup of handling for WidgetMessaging instances
When setting, delete the old one. Because delete checks if it exists first, we can safely call this.

The change in FromWidgetPostMessageApi is just something noticed while debugging.
2019-04-01 19:50:05 -06:00
Travis Ralston
a4f76670c4 Don't re-init the stickerpicker unless something actually changes
Fixes https://github.com/vector-im/riot-web/issues/9354

https://github.com/matrix-org/matrix-react-sdk/pull/2801 introduced a change which tried to make sure that when the widget URL was changed that the picker would be re-mounted, however it accidentally introduced a regression. While it effectively did the task it wanted to, it failed to keep the previously-mounted sticker picker alive. This is because the Stickerpicker component is remounted when opened, and the _updateWidget function is called. This results in this.state not having the "current" widget, meaning a URL change is always detected when the component is remounted (room changes, open sticker picker). 

Instead of remounting always, we'll instead track which sticker picker widget is being used out of band. This therefore means that whenever the Stickerpicker component is mounted it doesn't create a whole new widget, and the existing (background) picker can be used. This also fixes the loading screen that people would see when opening the sticker picker after switching rooms, something which the persistent widget stuff is supposed to solve.
2019-04-01 19:48:05 -06:00
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
0978ab3da0 Support stacking dialogs to prevent unmounting
Fixes https://github.com/vector-im/riot-web/issues/8371
2019-02-28 15:55:58 -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
f82cc28f96
Merge pull request #2701 from matrix-org/travis/fix-invites
Change the room list algo to eagerly delete and carefully insert
2019-02-26 09:26:32 -07:00
Michael Telatynski
8d149575ea Merge branches 'develop' and 't3chguy/room_context_menu_settings' of github.com:matrix-org/matrix-react-sdk into t3chguy/room_context_menu_settings 2019-02-25 23:12:06 +00:00
Michael Telatynski
d4b6ce6932 Apply PR feedback, don't change room to go to its settings
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
2019-02-25 23:08:51 +00: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
c0b9d99385 only import throttle fn 2019-02-07 16:03:12 +00:00
Bruno Windels
35d9c02ecd throttle custom tags updating in LLP 2019-02-07 15:28:22 +00:00
Bruno Windels
d2ac434545 no need to update tags when app is booting, wait till sync 2019-02-07 14:41:39 +00:00
Bruno Windels
64bb6d2b1f dont remove tags prop from state on logout as we assume its always there 2019-02-07 14:41:19 +00:00
Bruno Windels
8eb1f15ed4 do more explicit check 2019-02-07 12:18:52 +00:00