Commit graph

49 commits

Author SHA1 Message Date
Travis Ralston
ec2528e8b5
Update MatrixActionCreators.js 2018-11-04 23:00:47 -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
Bruno Windels
93d34e7b3d fix lint 2018-09-19 12:00:29 +02:00
Bruno Windels
2ed414494f use Room.myMembership event instead of RoomMember.membership for me
This is more reliable with LL enabled as the syncing user is
only known when it was active in the current timeline
or when the members have been loaded
2018-09-17 19:14:52 +02:00
Bruno Windels
dcc8a45aa1 add final return for clarity 2018-09-10 16:55:24 +02:00
Bruno Windels
9a3717a274 only dispatch an action for self-membership
as everything listens to the dispatcher, dispatching an action can be quite slow,
especially when only matched in one listener, and the rest all having to be called
to just say "no, thanks". This is especially the case for the RoomMember.membership
event being put on the dispatcher, as there can be thousands of these events
when the room members are loading.

Since the RoomMember.membership action is only used on one place,
and only for the syncing user, change it to just that and only dispatch
in that case. This saves 100-300ms when setting the OOB members in
a big room (7000k members)

Maybe later on we can back this by room.getMyMembership() and avoid the
listener even...
2018-09-07 19:53:01 +02:00
Luke Barnard
4b6140b6c5 Fix broken import preventing people tag 2018-03-22 10:23:34 +00:00
Luke Barnard
9e969e33b7 Reorder the RoomListStore lists on Event.decrypted 2018-02-23 10:32:33 +00:00
Luke Barnard
a78575929c Document a few action creators 2018-02-21 10:15:52 +00:00
Luke Barnard
644ddbf9b9 Regenerate room lists on Room event
To make sure that we handle rooms that our
client has not seen previously, we regenerate
the room list when the room is stored -
which is indicated by the js-sdk by the
Room event.
2018-02-20 17:57:46 +00:00
David Baker
fd90a8b23c
Merge pull request #1756 from matrix-org/luke/fix-recent-ordering
Make RoomListStore aware of Room.timeline events
2018-02-20 10:17:16 +00:00
Luke Barnard
32130fbc28 Don't regenerate RoomListStore state for notifs/scrollback/etc.
Only do so for the live timeline of rooms.
2018-02-19 09:56:03 +00:00
Luke Barnard
3f6c15506c Remove unused room parameter of MatrixActions.Room.timeline 2018-02-16 16:17:47 +00:00
Luke Barnard
84ab1ae3e2 Do not assume that tags have been removed
when moving tags
2018-02-16 15:52:15 +00:00
Luke Barnard
94a0a90457 Make RoomListStore aware of Room.timeline events
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".
2018-02-16 14:16:50 +00:00
Luke Barnard
db4f0cb0bf Handle adding previously removed tags 2018-02-14 16:40:24 +00:00
Luke Barnard
a34fea8af8 Merge branch 'develop' into luke/feature-tag-panel-tile-context-menu 2018-02-13 16:51:00 +00:00
Luke Barnard
3eeef064bf Remove unused asyncId 2018-02-12 18:37:54 +00:00
Luke Barnard
e3f68f12c8 Add context menu to TagTile
With two options: View Community and Remove, which
removes the tag from the panel.
2018-02-12 18:01:08 +00:00
lukebarnard
9b0df19149 Make RoomListStore aware of sub list orderings
so that it can do optimistic updates of ordered lists.
2018-02-08 16:20:37 +00:00
Luke Barnard
21d70125e4 Dispatch MatrixActions synchronously
Otherwise we risk blocking the dispatches on other work, and they
do not need to be done asynchronously.

This emerged as a bug where the room list appeared empty until
MatrixActions.sync dispatches all occured in one big lump, well
after the sync events being emitted by the js-sdk.
2018-02-08 16:17:26 +00:00
lukebarnard
1ea6301eca Add index fix again
This was changed on /develop to fix an issue where the incorrect
index was being used in a condition to handle literal edge cases
of dragging room tiles to start or end of an ordered sublist.
2018-02-06 14:25:50 +00:00
lukebarnard
b744dbaab7 Handle setting a newTag without metaData
metaData is actually the request body for the PUT that adds the tag
so we need to send {} for e.g. m.lowpriority, which is not manually
ordered.
2018-02-06 11:56:55 +00:00
lukebarnard
c665c1170b Regenerate room lists when we get RoomMember.membership 2018-02-05 18:27:50 +00:00
lukebarnard
701abb6a21 Move management of room lists to RoomListStore
this is part maintenance to make RoomList clearer and part
allowing room list state to be modified via a dispatch.
2018-01-25 22:16:03 +01:00
lukebarnard
38de8a129b Add transaction capability to asyncActions
for relating pending/success/failure actions. Particularly useful for mapping
a failure to a pending action to roll back any optimistic updates.
2018-01-25 21:45:21 +01:00
lukebarnard
2a1f8bd394 Ignore remote echos caused by this client
by sending each tag_ordering with a _storeId and ignoring accout data
that has a matching _storeId.

This will tend to become out of sync with the server over time if
requests continually fail, but subsequent successful requests will
rectify any differences.
2018-01-17 10:51:28 +00:00
lukebarnard
d2e5b12271 Update jsdoc for moveTag 2018-01-16 09:46:48 +00:00
lukebarnard
16c13fb079 Replace TagPanel react-dnd with react-beautiful-dnd
This new library handles the simple case of an ordered vertical
(or horizontal) list of items that can be reordered.

It provides animations, handles positioning of items mid-drag
and exposes a much simpler API to react-dnd (with a slight loss
of potential function, but we don't need this flexibility here
anyway).

Apart from this, TagOrderStore had to be changed in a highly
coupled way, but arguably for the better. Instead of being
updated incrementally every time an item is dragged over
another and having a separate "commit" action, the
asyncronous action `moveTag` is used to reposition the tag in
the list and both dispatch an optimistic update and carry out
the request as before. (The MatrixActions.accountData is still
used to indicate a successful reordering of tags).

The view is updated instantly, in an animated way, and this
is handled at the layer "above" React by the DND library.
2018-01-15 18:12:27 +00:00
Luke Barnard
629cd13319 Even better docs 2017-12-13 18:28:43 +00:00
Luke Barnard
6b02f59fb7 Spelling 2017-12-13 17:32:46 +00:00
Luke Barnard
950f591b3f Clarify more docs 2017-12-13 15:50:20 +00:00
Luke Barnard
fe6b7c0ea2 Improve _addMatrixClientListener docs 2017-12-13 15:43:39 +00:00
Luke Barnard
31ea092d99 Improve createAccountDataAction docs 2017-12-13 15:39:17 +00:00
lukebarnard
ddf5dbad89 Doc fetchJoinedGroups 2017-12-13 11:05:23 +00:00
lukebarnard
a653ece99e Doc commitTagOrdering 2017-12-13 11:05:06 +00:00
lukebarnard
5de0559192 Adjust actionCreators doc 2017-12-13 10:39:45 +00:00
lukebarnard
cc30b8fb09 Doc MatrixActionCreators properly 2017-12-13 10:37:14 +00:00
lukebarnard
d5534a9ece Copyright 2017-12-13 10:17:38 +00:00
Luke Barnard
13925db251 Refactor to allow dispatching of two kinds of Actions
They are:
 1. The existing type of Action, Objects with an `action` type.
 1. Asyncronous Actions, functions that accept a `dispatch` argument, which can be used to dispatch Actions asyncronously.
2017-12-12 17:32:43 +00:00
Luke Barnard
60d8ebb914 Refactor MatrixActions to something much easier to grok. 2017-12-12 16:05:18 +00:00
Luke Barnard
8d2d3e62cd Only commit a non-falsy tags list 2017-12-11 17:30:10 +00:00
Luke Barnard
991ea4ebe5 Fix a few bugs with TagOrderStore:
- Have TagOrderStore listen for MatrixSync actions so that it can initialise
   tag ordering state.
 - Expose an empty list until the client has done its first sync and has
   fetched list of joined groups
2017-12-11 17:17:05 +00:00
Luke Barnard
df88b71dbb Comment typo 2017-12-08 16:47:52 +00:00
Luke Barnard
53e7232a97 Linting 2017-12-08 11:08:57 +00:00
Luke Barnard
31a52c15bd Fix bug with removing matrix listeners 2017-12-08 10:55:29 +00:00
Luke Barnard
72550961e5 Move 'commit_tags' to action creator 2017-12-08 10:52:20 +00:00
Luke Barnard
12515441cd Handle accountData events from TagOrderStore
This introduces a generic way to register certain events emitted by
the js-sdk as those that should be propagated through as dispatched
actions.

This allows the store to treat the js-sdk as the "Server" in the
Flux data flow model. It also allows for stores to not be aware
specifically of the matrix client if they are only reading from it.
2017-12-08 10:05:18 +00:00
Luke Barnard
ee6df105fe Introduce action creators
These can be used to dispatch actions immediately, or after some asynchronous
work has been done. Also, create GroupActions.fetchJoinedGroups as an example.

The concept of async action creators can be used in the following cases:
 - stores or views that do async work, dispatching based on the results
 - actions that have complicated payloads, would make more sense as functions
   with documentation that dispatch created actions.
2017-12-07 14:17:32 +00:00