Commit Graph

1837 Commits (a9c42bbbd7107dcef5c9f4ef7fa530bdd42f100b)

Author SHA1 Message Date
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
Travis Ralston 57b99893e5
Merge pull request #1936 from turt2live/travis/pinned-room-list
Add options to pin unread/mentioned rooms to the top of the room list
2018-11-01 08:04:12 -06:00
Aaron Raimist 49ce4ef117
eslint --fix src/
Signed-off-by: Aaron Raimist <aaron@raim.ist>
2018-10-26 22:50:38 -05:00
Travis Ralston 3d8f0adf56 Move pinned rooms check to the RoomListStore 2018-10-12 14:35:54 -06: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 fe734b944e remove obsolete warning as peeking will cause the membership to be null 2018-09-13 18:45:38 +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
David Baker 54620591cc Don't crash if the value of a room tag is null
We were checking that the order was not null, but not the object
itself.
2018-08-23 12:05:09 +01:00
David Baker 941a3cfa53 Support M_INCOMPATIBLE_ROOM_VERSION
For https://github.com/vector-im/riot-web/issues/7164
2018-08-21 18:33:25 +01:00
David Baker 94c7ae2bf5
Merge pull request #2098 from matrix-org/dbkr/destroy_widget
Destroy non-persistent widgets when switching room
2018-08-17 09:53:41 +01:00
David Baker e3643bd74c Lint 2018-08-17 09:42:23 +01:00
Bruno Windels cead4096d8
Merge pull request #2118 from matrix-org/bwindels/feature_lazyloading
Lazy loading of room members
2018-08-16 18:14:55 +02:00
Bruno Windels 440ebd187d getMyMembership() doesn't take id anymore 2018-08-14 11:47:05 +02:00
David Baker f44cc8e66e
Merge pull request #2112 from matrix-org/dbkr/recognise_server_notices_room
Recognise server notices room(s)
2018-08-07 09:52:25 +01:00
David Baker b5ce1ac5e1 Recognise server notices room(s)
and put them in their own section at the bottom
2018-08-06 18:00:40 +01:00
David Baker b2302af708 Update room tags behaviour to match spec more
Fix Riot's behaviour with room tags after my cleanup in
https://github.com/matrix-org/matrix-doc/pull/1457 . Although, reading
it again, it's not clear how you're supposed to tell the difference
between a reverse-dns tag name and a legacy freeform text tag
(contains a '.'?) - I've left it detecting these as freeform text
for now.
2018-08-06 16:58:54 +01:00
David Baker 7875d37c8e Destroy non-persistent widgets when switching room 2018-08-01 15:01:11 +01:00
Bruno Windels cfd20c7e85 fix error/tests 2018-07-25 16:10:49 +02:00
Bruno Windels d87d34030a fix dm detection and conf call code with lazy loading 2018-07-25 16:10:49 +02:00
Bruno Windels 7ea913ccec fall back to synced membership when own membership is not yet available (due to lazy loading) 2018-07-25 16:10:49 +02:00
Bruno Windels 8529bc55e3 use helper method for knowing whether a user was kicked
mainly for readability, but also to discourage grabbing into the member
because of lazy loading changes
2018-07-25 16:10:49 +02:00
Bruno Windels de3e143a8f only lazy load the members when viewing a joined room 2018-07-25 16:10:49 +02:00
Bruno Windels 8c985bd049 ask client to lazy load room members when viewing a room 2018-07-25 16:10:49 +02:00
David Baker cdd73e6e1f Check matrix client exists when stopping 2018-07-24 16:55:45 +01:00
David Baker 7044410a13 Move destroyPersistentWidget to store 2018-07-24 16:50:34 +01:00
David Baker ec4c7ffb71 Make ActiveWidgetStore clear persistent widgets
ActiveWidgetStore is now reponsible for removing the current
persistent widget from the store if it's been removed from whatever
room it was in. As per comment, this leaves us with the store updating
itself in this case but in all other cases, views call setters on the
store to update its state. We should make it so the store keeps itself
up to date and views aren't responsible for keeping the store up to date.

The store now emits events so it can notify PersistentApp when it changes.

Fixes https://github.com/vector-im/riot-web/issues/7076
2018-07-24 16:21:43 +01:00
David Baker 7aab6fa6f1 Merge remote-tracking branch 'origin/develop' into dbkr/widget_echo 2018-07-18 09:35:57 +01:00
Matthew Hodgson 02c3bc9476
Merge pull request #2069 from matrix-org/t3chguy/slate_cont2
Moar Slate Fixes
2018-07-17 17:15:01 +01:00
Michael Telatynski 23b6abf8b7
no point saving history at this point, maybe future supported
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
2018-07-17 09:27:11 +01:00
Michael Telatynski cbe5944ff0
preserve selection and history between room changes and refreshes
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
2018-07-16 22:04:42 +01:00
David Baker a79caed0c9 Merge remote-tracking branch 'origin/develop' into dbkr/tiny_jitsi_follows_you_between_rooms 2018-07-16 17:21:51 +01:00
David Baker 379d65bd6c
Merge pull request #2064 from matrix-org/t3chguy/slate_cont2
simplify MessageComposerStore and improve its performance
2018-07-16 17:20:48 +01:00
Michael Telatynski 2f1779751b
make the MessageComposerStore stateless for better performance
and inter-tab composition (by simplifying it. WIN-WIN)

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
2018-07-16 16:56:08 +01:00
David Baker d16ac4d80c
Merge pull request #1890 from matrix-org/matthew/slate
Replace Draft with Slate
2018-07-16 14:16:25 +01:00
David Baker 4c6419a3c5 Merge remote-tracking branch 'origin/develop' into dbkr/widget_echo 2018-07-16 13:24:13 +01:00
David Baker 0f32c3a018 PR feedback 2018-07-16 13:18:10 +01:00
Michael Telatynski 59a14f2c0b
re-hydrate Values which have been serialized into LocalStorage
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
2018-07-15 20:34:27 +01:00
David Baker e56feea9ec Put always-on-screen widgets in top left
always-on-screen widgets now appear in the top-left where the
call preview normally is if you're not in the room that they're in.

Fixes https://github.com/vector-im/riot-web/issues/7007
Based off https://github.com/matrix-org/matrix-react-sdk/pull/2053
2018-07-12 18:43:49 +01:00
David Baker 8f10ee01c6 Implement always-on-screen capability for widgets
As per https://github.com/matrix-org/matrix-doc/issues/1354

This is whitelisted to only jitsi widgets for now as per comment,
mostly because any widget that we may make always-on-screen we need
to preemptively put in a PersistedElement container, which is
unnecessary for any other widget.

Apologies that this does a bunch of refactoring which could have
been split out separately: I only discovered what needed to be
refactored in the process of doing this.

Fixes https://github.com/vector-im/riot-web/issues/6984
2018-07-11 18:07:32 +01:00
Michael Telatynski fd4f9679df
convert md<->rt if the stored editorState was in a different state
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
2018-07-11 09:43:39 +01:00
Matthew Hodgson efdc5430d7 merge develop 2018-07-09 17:50:07 +01:00
David Baker b6f854abe4 Simplify event name as it's the only one 2018-07-05 20:00:42 +01:00
David Baker 658ac73064 comments 2018-07-05 19:57:24 +01:00
David Baker 3f60300983 Remove redundant check 2018-07-05 19:51:12 +01:00
David Baker 8c10dc1860 Remove unhelpful commented code 2018-07-05 19:50:11 +01:00
David Baker 7e2b559ccd Make if clearer 2018-07-05 19:46:37 +01:00
David Baker fb7ce9dd7f More doc 2018-07-05 19:40:45 +01:00
David Baker 1f2d279a0a Consistency, redundant check & doc 2018-07-05 19:38:42 +01:00
David Baker eb552e5cef Just pass the roomId into WidgetEchoStore 2018-07-05 18:43:20 +01:00
David Baker 3199e68578 Lint 2018-07-03 11:22:19 +01:00
David Baker 8b64ddcbe8 Do some level of local echo for widgets
* Show a spinner while we wait for widgets to be deleted
 * Hide widgets while they're pending deletion
 * Don't put another jitsi widget into the room if there's already
   one pending
2018-07-03 11:16:44 +01:00
Michael Telatynski a548c83647
when the user switches room, close room settings
this is especially annoying if they choose Leave Room
which indirectly switches room

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
2018-06-26 17:07:39 +01:00
Luke Barnard da9fe9917b Fix click on faded left/right/middle panel -> close settings
- implement generic dispatch to close user/room/group settings
 - use dispatch to allow clicks on disabled left/right/middle panel to
   close settings

A much more maintainable approach would be to use dedicate routing
instead of doing different things depending on what page of the app is
currently being viewed. At the very least we could make the concept of a
settings page generic.
2018-05-29 13:16:39 +01:00
Matthew Hodgson 9c0c806af4 correctly send pills in messages 2018-05-12 20:04:58 +01:00
Matthew Hodgson 02947063d3 Merge branch 'develop' into matthew/slate 2018-05-05 22:45:44 +01:00
Michael Telatynski f2102e283c
Merge branches 'develop' and 't3chguy/m.relates_to' of github.com:matrix-org/matrix-react-sdk into t3chguy/m.relates_to 2018-05-02 13:08:38 +01:00
David Baker 3d478c3c3a
Merge pull request #1867 from matrix-org/luke/fix-group-request-concurrency
Prevent error responses wedging group request concurrency limit
2018-05-02 10:45:12 +01:00
Luke Barnard 2dfb3146b0 Simplify concurrent request error handling 2018-05-02 10:39:15 +01:00
Luke Barnard 71c1198d12 Rewrite limitConcurrency to fix error catching
Make sure that we only catch errors that are a result of
calling fn()
2018-05-01 18:01:25 +01:00
Luke Barnard bd703b17e5 Update documentation for GroupStore.registerListener 2018-05-01 16:57:28 +01:00
Luke Barnard 56ec7713bb Refresh group rooms and members when selecting a tag 2018-05-01 16:54:14 +01:00
Luke Barnard 4d8394954c Only create one group store listener in RoomList
Instead of creating several and destroying the reference to the one
created before.
2018-05-01 14:24:58 +01:00
Luke Barnard da1a5616eb Prevent error responses wedging group request concurrency limit
Fixes https://github.com/vector-im/riot-web/issues/6592
2018-05-01 14:04:13 +01:00
Luke Barnard e3a07be127 Remove GroupStore logging 2018-05-01 13:14:01 +01:00
Luke Barnard 023daef4b7 Refactor GroupStores into one global GroupStore
Take a step closer to a flux-like architecture for group data, for
the purposes of providing features that require it.

Now the app has a single GroupStore that can be poked to fetch
updates for a particular group.
2018-05-01 11:24:17 +01:00
Matthew Hodgson 75a2be1a8d WIP (doesn't build yet) replacing draft with slate 2018-04-23 01:13:18 +01:00
Michael Telatynski c77807bd22
Merge branches 'develop' and 't3chguy/m.relates_to' of github.com:matrix-org/matrix-react-sdk into t3chguy/m.relates_to
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>

# Conflicts:
#	src/i18n/strings/en_EN.json
#	src/i18n/strings/eu.json
#	src/i18n/strings/fr.json
#	src/i18n/strings/lv.json
#	src/i18n/strings/ru.json
#	src/i18n/strings/zh_Hant.json
2018-04-12 09:48:06 +01:00
Luke Barnard 42141f7da7 Fetch group data when leaving or joining to update the view 2018-04-10 10:03:54 +01:00
Michael Telatynski b5ed08eba2
Merge
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
2018-03-24 17:52:49 +00:00
Luke Barnard 35cc443562 Limit group requests to 3 at once
using a FIFO queue.

This is needed in order to lower the priority of getting group
state and prioritise everything else, namely initial sync.

It should be noted that this by no means guarantees that the
first incremental sync will happen sooner; the client could
end up doing some other requests first instead.
2018-03-13 11:35:19 +00:00
Luke Barnard faf517419f Return null instead of undefined on failure 2018-03-06 12:14:41 +00:00
Luke Barnard 0fc79a4a0d Remove delay used in testing 2018-03-06 12:13:46 +00:00
Luke Barnard afbd563810 Potentially fix a memory leak in FlairStore
For each successful request of a group profile, we previously
emitted an `updateGroupProfile` event per caller of
`getGroupProfileCached`. This is sub-optimal because only a single
event emit is required to update the views listening.

It's possible that this was enabling some race to cause a memory
leak but this is not certain, hence the extra logging for future
debugging.
2018-03-06 11:33:56 +00:00
Luke Barnard d5908fbc1e Fix FlairStore cache busting 2018-03-01 15:06:05 +00:00
Luke Barnard 4037a22492 Fix bug where avatar change not reflected in LLP
Fixes vector-im/riot-web#6189
2018-03-01 14:40:03 +00:00
Luke Barnard fae7af1a62 Do proper null-checks on decypted events to fix NPEs
Previously we assumed that a decrypted event has a room_id
but this isn't necessarily true for to_device events.

It makes sense to ignore events that aren't associated with
rooms anyway given that the list we're updating only contains
rooms!
2018-02-23 15:04:04 +00:00
Luke Barnard 9e969e33b7 Reorder the RoomListStore lists on Event.decrypted 2018-02-23 10:32:33 +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
Michael Telatynski 665ddccb0d
restrict to m.text for now
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
2018-02-20 15:45:25 +00:00
Michael Telatynski 34b427d15e
s/quote_event/reply_to_event/
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
2018-02-19 23:41:07 +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 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 c8ccbed0b1
Merge pull request #1751 from matrix-org/luke/dnd-group-view-tag-panel
Implement GroupTile avatar dragging to TagPanel
2018-02-15 11:05:28 +00:00
Luke Barnard 389d96bc46 Use optimistic removedTagsAccountData state in TagOrderStore
when receiving TagOrderActions.moveTag.pending, which now exposes
this state.
2018-02-14 16:47:29 +00:00
Luke Barnard 3020c8cd94 Fix custom tags not being ordered manually
Actually fixes vector-im/riot-web#6135 unlike #1748, which
incorrectly assumed that custom tags would be included in
listOrders.

This fix makes sure that the `default` case in the `switch`
is actually used.
2018-02-14 11:23:29 +00:00
Luke Barnard c670b76ec8
Merge pull request #1743 from matrix-org/luke/feature-tag-panel-tile-context-menu
Add context menu to TagTile
2018-02-13 17:28:43 +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 f16bc93fee If a tag is unrecognised, assume manual ordering
(as we did previously)

Fixes https://github.com/vector-im/riot-web/issues/6135
2018-02-13 16:09:17 +00:00
Luke Barnard 5af560f625 Make removedTags a Set for perf 2018-02-13 14:43:34 +00:00
Luke Barnard 322012cf88 Add comment to explain hacky optimism 2018-02-12 18:46:36 +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
lukebarnard dd0e981d72 Handle indication from server that a room has no more tags 2018-02-06 12:00:23 +00:00
lukebarnard 8d0d0b43ff Handle first tag added/last tag removed
This is a special case because untagged rooms should
appear in im.vector.fake.recent and tagged rooms
should not.
2018-02-06 12:00:06 +00:00
lukebarnard c665c1170b Regenerate room lists when we get RoomMember.membership 2018-02-05 18:27:50 +00:00
lukebarnard 9982efbd8f Regenerate room lists when we get m.direct 2018-02-05 18:06:29 +00:00
lukebarnard 330ce0f02e On failure, regenerate state from sdk
Instead of using history, which could be unpredictable
2018-02-05 17:34:05 +00:00
lukebarnard 81eca49266 Merge branch 'luke/room-list-flux' of github.com:matrix-org/matrix-react-sdk into luke/room-list-flux 2018-02-05 11:40:42 +00:00
Luke Barnard ff8fcb3139
Merge branch 'develop' into luke/room-list-flux 2018-02-05 11:39:39 +00:00
David Baker cfd1f28258
Merge pull request #1722 from matrix-org/luke/load-tags-after-first-sync
Use correct condition for getting account data after first sync
2018-01-30 15:21:12 +00:00
lukebarnard 40907ecf29 Use correct condition for getting account data after first sync
so that we can get tags sooner.
2018-01-26 19:39:06 +01:00
lukebarnard 4820a195ab Remove logging 2018-01-26 09:15:03 +01: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
Michael Telatynski 37dcb33b15
Reset quotingEvent on Room Change because inideal UX
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
2018-01-22 14:45:04 +00:00
lukebarnard 5f413ddf8b Do not fetch GroupStore resources if already fetching 2018-01-17 17:01:42 +00:00
lukebarnard 3ebf278cf3 Refactor GroupStore based on existing STATE_KEY concept
by factoring out a lot of repeated code.
2018-01-17 16:59:13 +00: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 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
Michael Telatynski 1bc9d344ae
Merge branch 'develop' of github.com:matrix-org/matrix-react-sdk into t3chguy/nvl/rich_quoting
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>

# Conflicts:
#	src/components/views/messages/TextualBody.js
2018-01-10 11:54:58 +00:00
lukebarnard 85cdd888e8 Combine TagOrderStore and FilterStore
so that shift-click semantics can work. The store that computes the shift-click
rules has to be aware of the actual order of tags displayed, so they must be done
in the same store.
2018-01-03 11:33:59 +00:00
Luke Barnard 5abf0440c6
Merge pull request #1666 from matrix-org/luke/fix-duplicate-group-profile-requests
Dedupe requests to fetch group profile data
2018-01-02 19:02:50 +00:00
lukebarnard 479e88cff7 Log an error to get group profile data 2018-01-02 18:55:50 +00:00
lukebarnard 45e860de7a Document GroupStore.registerListener 2018-01-02 18:12:08 +00:00
lukebarnard 3947a72d1b Fix to allow subsequent group profile requests if one fails
Also, delete the groupProfilePromise immediately after setting
the group profile (the first if-statement will prevent a new
request from being started).
2018-01-02 10:42:48 +00:00
Luke Barnard 71740cc176 Merge branch 'develop' into luke/fix-room-list-group-store-leak 2017-12-15 17:36:36 +00:00
Luke Barnard 6e832c7d73 Dedupe requests to fetch group profile data 2017-12-15 16:28:50 +00:00
Luke Barnard 34e455c6fc Fix leaking of GroupStore listeners in RoomList 2017-12-15 14:12:21 +00:00
lukebarnard e1ea8f0a78 Copy state when initialisng, reset state when logging out 2017-12-13 10:57:47 +00:00
lukebarnard d5534a9ece Copyright 2017-12-13 10:17:38 +00:00
Luke Barnard 60d8ebb914 Refactor MatrixActions to something much easier to grok. 2017-12-12 16:05:18 +00:00
Luke Barnard 3e532e3722 Use consistent indentation and break;s in TagOrderStore switch 2017-12-12 14:10:39 +00:00
Luke Barnard a120335130 Handle groups being joined and left 2017-12-11 18:03:19 +00:00
Luke Barnard 0b38bf5e7b Do not allow ordering until TagOrderStore has loaded 2017-12-11 17:24:33 +00:00
Luke Barnard aa914098dc Return null if TagOrderStore is loading
The view should decide the default state.
2017-12-11 17:19:29 +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
Michael Telatynski 0f85391587
Implement Rich Quoting/Replies
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
2017-12-10 12:50:41 +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
Luke Barnard 8f88995b3d Add analytics to TagOrderStore 2017-12-06 14:22:11 +00:00
Luke Barnard 4af7def20e Use AccountData im.vector.web.tag_ordering
Also, make defaults sensible
2017-12-06 14:13:08 +00:00
Luke Barnard 82a95f0793 Simplify order_tag in TagOrderStore
such that:
 - it takes a targetTag to be replaced instead the previous tag to insert after
 - it optionally displaces the targetTag before or after the inserted tag
2017-12-06 11:22:06 +00:00
Luke Barnard 8178496457 Implement Store for ordering tags in the tag panel 2017-12-05 14:45:44 +00:00
Luke Barnard 3bcb3195c4 Implement shift-click and ctrl-click semantics for TP 2017-11-30 14:48:54 +00:00
Luke Barnard 45bcb6f2ed Implement TagPanel (or LeftLeftPanel) for group filtering
This allows for filtering of the RoomList by group. When a group is selected, the room list will show:
 - Rooms in the group
 - Direct messages with members in the group

A button at the bottom of the TagPanel allows for creating new groups, which will appear in the panel following creation.
2017-11-29 16:53:43 +00:00
Luke Barnard 7ec4010881 Make GroupStore use MatrixClientPeg
To avoid weirdness with using a cached matrix client
2017-11-28 11:54:05 +00:00
lukebarnard 2913d396ef Remove redundant super class EventEmitter for FlairStore
, which seemingly is not being used.
2017-11-20 11:34:20 +00:00
Richard van der Hoff c48994e981 Flairstore: Fix broken reference 2017-11-17 13:56:56 +00:00
Luke Barnard 31be27515c Modify the group room visibility API to reflect the js-sdk changes
See https://github.com/matrix-org/matrix-js-sdk/pull/569
2017-11-09 16:28:21 +00:00
Luke Barnard 65cea53f3d
Merge pull request #1592 from matrix-org/luke/groups-fix-accept-invite-refresh-members
Fetch group members after accepting an invite
2017-11-08 13:35:53 +00:00
Luke Barnard 3e3ebd6358 Fetch group members after accepting an invite 2017-11-08 11:52:52 +00:00
Luke Barnard 1c5e7f3048 Fix FlairStore getPublicisedGroupsCached to give the correct, existing promise 2017-11-08 11:31:04 +00:00
Luke Barnard edc744067f Add checkbox to GroupAddressPicker for determining visibility of group rooms 2017-11-07 18:51:41 +00:00
Luke Barnard febeb0429e Throw an error when trying to create a group store with falsey groupId 2017-11-06 10:18:10 +00:00
Luke Barnard da23afdec2 Better comment on FlairStore _usersInFlight 2017-11-03 18:48:15 +00:00
Luke Barnard 4d8f18742b Check against non-existant promise to resolve a user's groups 2017-11-03 18:43:43 +00:00
Luke Barnard d64fc4c842 Fix Flair not appearing due to missing this._usersInFlight 2017-11-03 18:19:10 +00:00
David Baker 8800081cb9
Merge pull request #1567 from matrix-org/luke/fix-flair-store
Fix multiple requests for publicised groups of given user
2017-11-02 16:09:07 +00:00
Luke Barnard 21e09840dc Fix multiple requests for publicised groups of given user
Previously, a single user could end up in multiple batches, which would have been fine if the logic didn't assume otherwise. If a request took longer than 200ms, multiple batches would occur with intersecting sets of users, deleting promises that were then assumed to exist.

The logic now takes all "in flight" users to also not be "pending". Pending now means that the user will be processed in the next batch. "In flight" means the user is part of an ongoing batch.
2017-11-02 15:59:26 +00:00
Luke Barnard bf77b51b5e Merge branch 'develop' into luke/groups-room-publicity 2017-11-02 13:39:33 +00:00
Luke Barnard 790db94fd7 Add toggle to alter the visibility of a room-group association 2017-11-02 13:31:11 +00:00
Matthew Hodgson 7d7cd30e46 turn NPE on flair resolution errors into a logged error 2017-11-01 22:10:03 +00:00
Luke Barnard 16dca08b77 Use constants instead of string literals 2017-10-31 16:13:13 +00:00
Luke Barnard 775468e71a Display whether the group summary/room list is loading
This uses a `ready` flag assigned to each fetching API used by the GroupServer. I've avoided making this generic for now for want of not doing so early.
2017-10-31 11:42:09 +00:00
Luke Barnard 175fadbb57 Add unregiseterListener to GroupStore 2017-10-27 15:08:38 +01:00
Luke Barnard 5d0aa8d7f7 Handle 403 when inspecting invited users as non-member 2017-10-27 11:38:10 +01:00
Luke Barnard e094c32c62 Simplify GroupStore listener registration 2017-10-27 11:38:10 +01:00
Luke Barnard 7b666af24c When dispatching view_[my_]group[s], reset RoomViewStore
so that RoomTiles are not highlighted when the user is looking at MyGroups or GroupView
2017-10-24 16:32:52 +01:00
Luke Barnard 3ae31dd426 Make GroupStoreCache global for cross-package access 2017-10-24 10:39:47 +01:00
Luke Barnard b9dc5cb5ed Merge branch 'develop' into luke/groups-update-on-invite 2017-10-23 16:05:52 +01:00
Luke Barnard 0799e5cde4 Refresh group member lists after inviting users 2017-10-23 16:04:26 +01:00
Luke Barnard 0ff5b9c6a7 Invalidate the user's public groups cache when changing group publicity
This will make the changes to their Flair "live", but only from the user's own perspective.
2017-10-23 15:28:38 +01:00
Luke Barnard b0f8619754 Improve MyGroups UI
as per design layed out by @tur2live!
2017-10-19 17:24:45 +01:00
Luke Barnard 25d14af616 Export a global.singletonFlairStore to allow cross-project singleton 2017-10-19 12:00:03 +01:00
Luke Barnard 71443e9b94 Remove logs comments 2017-10-19 10:34:24 +01:00
Luke Barnard 5f3c06b38a Factor out Flair cache into FlairStore
This will make invalidating the userGroups cache for the user architecturally more sound (the plan is to have GroupStore hit FlairStore as opposed to Flair itself in order to invalidate the cache).
2017-10-19 10:28:59 +01:00
Luke Barnard 0415869b8c Add useful functions to GroupView to inspect user flags 2017-10-17 16:08:19 +01:00
Luke Barnard 917957c1dc Modify the group store to include group rooms
and modify components to use this new part of the store such that feedback can be given
when adding or removing a room from the room list.
2017-10-05 14:30:04 +01:00
Luke Barnard cbb36b163b Typo 2017-10-04 18:05:40 +01:00
Luke Barnard c1318e9102 Only maintain one GroupStore in the GroupStoreCache
So that the group store data is up-to-date and to prevent group stores hanging around in memory
2017-10-04 17:51:38 +01:00
Luke Barnard b16eb1713e Typo 2017-10-04 17:01:44 +01:00
Luke Barnard 4017fa7f1d Factor-out GroupStore and create GroupStoreCache
In order to provide feedback when adding a room to a group, the group summarry store needs to be extended to store the list of rooms in a group. This commit is the first step required.

The next step is to get the GroupRoomList listening to updates from GroupStore and expose the list of rooms from GroupStore.

(We're running out of words to describe the hierachy of things that store things)
2017-10-04 16:56:35 +01:00
David Baker 8ec1c3ecf4 lint 2017-09-26 14:58:49 +01:00
David Baker 8d0983ab02 Fix group membership publicity
* Read the new flag in the summary API (the one we were reading
   was actually whether the group server listed you as a member to
   non-members).
 * Remove call to now-dead _loadGroupFromServer andf use the store
   instead
2017-09-26 14:46:57 +01:00
Luke Barnard b8dca58f4f Pass matrixClient as an argument to GSS constructor 2017-09-25 10:02:13 +01:00
Luke Barnard 791bc5e7ac Create GroupSummaryStore for storing group summary stuff
- Acts as a layer between GroupView and the group APIs that modify the summary individually. This allows for abstraction of getting the new summary once a successful API hit has been done.
 - The plan is to also control the avatar, topic, body of the summary via the same class
2017-09-22 18:52:06 +01:00
David Baker 4d8eadad4f Clarify comment 2017-09-19 10:21:20 +01:00
David Baker c265ec9571 Fix RoomView stuck in 'accept invite' state
After accepting a 3pid invite.

Rather than clear the joining flag when the join request completes,
leave it so the RoomView can see that we're expecting the user to
be joined in the various stages that might go through (waiting for
join request, waiting for room object, waiting for 'joined' member
event). The problem in this case was that we had to wait a bit for
the last one, and there was no bit of state to represent it.

This hopefully also makes the logic somewhat simpler.

Fixes https://github.com/vector-im/riot-web/issues/5041
2017-09-15 15:07:09 +01:00
David Baker 1b355e1a13 Merge pull request #1391 from matrix-org/dbkr/fix_slash_join
Make /join join again
2017-09-15 09:56:02 +01:00
David Baker c814f02f34 Merge pull request #1390 from matrix-org/dbkr/create_room_no_spinner
Display spinner not room preview after room create
2017-09-15 09:18:55 +01:00
David Baker f3a4856593 Merge remote-tracking branch 'origin/develop' into dbkr/fix_slash_join 2017-09-14 23:09:26 +01:00
David Baker 1f837d2ae1 Make /join join again
The auto_join parameter to view_room got broken at some point so
/join took you to the room and then sat there like a lemon.

Fixes https://github.com/vector-im/riot-web/issues/5029
2017-09-14 23:06:00 +01:00
David Baker 6b6e59e0dd Display spinner not room preview after room create
After creating a room, display the activity spinner while we wait
for the room to come down the event stream.

This was the intention before but I can't see how it would have
worked: we were setting the 'joining' flag, but then resetting it
by claiming we were already joined in the view_room dispatch.

 * Send 'joining' instead of 'joined' in view_room dispatch, which
   will set the corresponding joining flag (ie. to indicate we've
   sent a request to join the room). Remove the 'joined' flag.
 * Reset 'joining' to false otherwise on a view_room dispatch to
   prevent it from leaking between rooms (this may have been the
   intention of the `if (payload.joined) newState.joining = false`?

Fixes https://github.com/vector-im/riot-web/issues/4701
2017-09-14 22:22:21 +01:00
David Baker ffb3d718d3 Fix the avatar / room name in room preview
When clicking on rooms from the room directory. When RoomViewStore
resolved the room alias, it threw away the out-of-band data in the
process. This must have been broken as part of the ILAG /
RoomViewStore stuff.
2017-09-13 15:48:53 +01:00
David Baker d714291aa1 Re-add doc on scroll state map structure 2017-09-08 13:27:14 +01:00
David Baker 7f44ac7403 Remove now unused stuff from RoomViewStore 2017-09-07 17:15:19 +01:00
David Baker 408b8c18ea Introduce a RoomScrollStateStore
to keep the place we're scrolled to in rooms. This mainly eleimates
the extra, superfluous onRoomViewStoreUpdate callback that
happened when the previous room saved back its scroll state.
Moving the scroll state to a separate store means we can have this
not emit events because nothing needs to know when the scroll state
changes.
2017-09-07 17:08:36 +01:00
Michael Telatynski 24599ace32
don't track error messages
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
2017-08-10 13:49:11 +01:00
Michael Telatynski bf98c0da7c
un-i18n Modal Analytics
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
2017-07-27 17:19:18 +01:00
Luke Barnard a921059432 Fix vector-im/riot-web#4526 by pretending to join
I thought about adding separate dispatches to prevent confusion but if anyone adds anything that listens to existing dispatches, they really ought to be grep-ing the world for said dispatch actions.
2017-07-06 17:40:27 +01:00
Luke Barnard 6b6af3f148 Remove RTE content_state logging 2017-07-06 11:17:54 +01:00
Luke Barnard df23a6cd85 Use Object.assign to set initial state of MessageComposerStore
Otherwise we just modify the initial state when running
2017-07-05 13:38:34 +01:00
Luke Barnard 3d5b3ed7ad Use ContentState instead and persist over localStorage 2017-07-05 11:49:34 +01:00
Luke Barnard 084a933dbd Implement MessageComposerStore to persist composer state across room switching
This behaviour was present in the old composer but implemented using local storage. This is unecessary as we don't really care about our drafts across clients, the important thing is that our draft is kept when switching rooms.

As a bonus, ifnore vertical arrow key presses when a modifier key is pressed so that the room switching keys (alt + up/down arrow) don't also cause history browsing (or autocomplete browsing).
2017-07-05 10:24:55 +01:00
Michael Telatynski 68fb11d2bf
de-lint LifecycleStore
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
2017-07-01 14:35:40 +01:00
Matthew Hodgson 032650e095 Merge branch 'develop' into t3chguy/fix_forwarding 2017-06-19 01:53:35 +01:00
Luke Barnard be58e1095e Don't peek when creating a room
This causes a race between receiving the room when starting to peek and receiving the room from joining it - https://github.com/vector-im/riot-web/issues/4330, https://github.com/matrix-org/riot-web-rageshakes/issues/196
2017-06-16 18:24:07 +01:00
Michael Telatynski 7b4cd31124 make forward_message be friendly with the RVS stuffs
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
2017-06-16 16:12:52 +01:00
Luke Barnard f25c081007 When not specified, remove roomAlias state in RoomViewStore 2017-06-14 12:05:25 +01:00
Richard van der Hoff 091d8d3d36 Merge pull request #1062 from matrix-org/luke/fix-rvs-join-by-alias
When joining, use a roomAlias if we have it
2017-06-08 18:41:59 +01:00
Luke Barnard cd6786114b When joining, use a roomAlias if we have it
And default to the current roomId otherwise
2017-06-08 17:40:53 +01:00
Luke Barnard c72edab726 Update doc for getInitialEventId 2017-06-08 17:28:56 +01:00
Luke Barnard cd8093d953 Explicit undefined initialEventPixelOffset 2017-06-08 17:28:21 +01:00
Luke Barnard 8cfdb4ce09 Clarify initial event 2017-06-08 17:27:04 +01:00
Luke Barnard 1ff2be1896 Update docs for RVS 2017-06-08 16:00:12 +01:00
Luke Barnard 36f72cccb5 Don't alter members of payload (when defaulting an event to scroll to), alter a copy 2017-06-08 15:55:47 +01:00
Luke Barnard 000a045e35 Rename RVS state (event -> initialEvent) and redocument 2017-06-08 15:52:21 +01:00
Luke Barnard d3cf78ff5a Control currently viewied event via RoomViewStore
Fix for https://github.com/vector-im/riot-web/issues/4224

Due to the way `MatrixChat` does a state update when the `view_room` dispatch fires and a second update when `RoomViewStore` sends an update, the current event ID and room ID were becoming out of sync. The solution devised was to have the event ID managed by the `RoomViewStore` itself and do any defaulting there (for when we revisit a room that we saved scroll state for previously).

This required a few changes:
 - The addition of `update_scroll_state` in `RoomViewStore` allows the `RoomView` to save scroll state for a room before swapping to another one. Previously the caching of scroll state was done in `RoomView`.
 - The `view_room` dispatch now accepts an `event_id`, which dictates which event is supposed to be scrolled to in the `MessagePanel` when a new room is viewed. It also accepts `event_offset`, but currently, this isn't passed in by a dispatch in the app, but it is clobbered when loading the default position when an `event_id` isn't specified. Finally, `highlighted` was added to distinguish whether the initial event being scrolled to is also highlighted. This flag is also used by `viewRoom` in `MatrixChat` in order to decide whether to `notifyNewScreen` with the specified `event_id`.
2017-06-08 14:17:49 +01:00
David Baker f6cfff9098 Cancel deferred actions
if the set mxid dialog is canceled
2017-06-05 18:37:38 +01:00
Luke Barnard 239874ccce Introduce state `peekLoading` to avoid collision with `roomLoading`
The room loading spinner will now be displayed if the alias is being resolved (roomLoading) or if the peek is being loaded for the room `peekLoading`.
2017-06-05 09:52:39 +01:00
David Baker ec0ad93ad7 Merge pull request #1007 from matrix-org/dbkr/propagate_room_join_errors
Propagate room join errors to the UI
2017-06-02 16:09:34 +01:00
David Baker ac0f2f79d1 Remove redundant room_id 2017-06-02 16:02:20 +01:00
David Baker f52035f3cd Set state from dispatch payload unconditionally
As apparently doing it confitionally is bad
2017-06-02 13:41:41 +01:00
Luke Barnard 953a573f81 Merge pull request #1006 from matrix-org/luke/new-guest-access-user-action-chat
Implement /user/@userid:domain?action=chat
2017-06-02 12:03:11 +01:00
David Baker 03f4f269ce Propagate room join errors to the UI
Dispatch so we can set the state in RoomViewStore. Show the error
when the room join fails (unsure if it's better to do this from
the component or the store). Remove unused joinError from roomview.
2017-06-02 11:53:10 +01:00
Luke Barnard defecb1b14 Implement /user/@userid:domain?action=chat
This is a URL that can be used to start a chat with a user.
 - If the user is a guest, setMxId dialog will appear before anything and a defered action will cause `ChatCreateOrReuseDialog` to appear once they've logged in.
 - If the user is registered, they will not see the setMxId dialog.

fixes https://github.com/vector-im/riot-web/issues/4034
2017-06-02 11:36:18 +01:00
Luke Barnard 7808994b71 Modify RVS test to wait until room loaded
This allows for the alias resolution to occur before a join is attempted. In theory, join_room could in future do an optional view_room-esque thing before attemping a join which would be less fragile than dispatching things in the right order.

Also, make sure the store indicates that it is not loading when a room ID has been used - no alias resolution need take place.
2017-06-02 09:22:48 +01:00
Luke Barnard 16c4c14a16 Fix to show the correct room 2017-06-01 18:01:30 +01:00
Luke Barnard b3a862c2c2 Remove redundant `reset` 2017-05-31 15:32:55 +01:00
Luke Barnard d83f18ab46 Remove cachedPassword from localStorage on_logged_out
Fixes https://github.com/vector-im/riot-web/issues/4101
2017-05-31 10:03:16 +01:00
Matthew Hodgson 44f479c38b Merge pull request #930 from matrix-org/luke/new-guest-access-reset-stores-on-logged-out
Reset store state when logging out
2017-05-26 17:45:32 +01:00
Luke Barnard ac44151e2a Put the reset method in the right scope... 2017-05-26 17:27:31 +01:00
Luke Barnard 9311b9012a Use the same `.reset` as RoomViewStore 2017-05-26 17:23:02 +01:00
Matthew Hodgson fbc3f83625 Merge pull request #928 from matrix-org/luke/new-guest-access-inidicate-joining-early
Use RVS to indicate "joining" when setting a mxid
2017-05-26 17:08:34 +01:00
Luke Barnard 2400efa92b Correct LifecycleStore docs 2017-05-26 11:48:38 +01:00
Luke Barnard 263a51938d Reset store state when logging out
This prevents leaking of state that we do not want to share with the next user
2017-05-25 17:16:16 +01:00
Luke Barnard 91edc06441 Use RVS to indicate "joining" when setting a mxid
This prevents RoomView from doing any peeking whilst the join/registration is in progress, causing weirdness with TimelinePanel getPendingEventList (which throws an error if called when peeking).
2017-05-25 17:04:42 +01:00
Luke Barnard dcf2fb68ae Remove console log 2017-05-24 18:02:17 +01:00
Luke Barnard 298c5e4df3 Implement a store for RoomView
This allows for a truely flux-y way of storing the currently viewed room, making some callbacks (like onRoomIdResolved) redundant and making sure that the currently viewed room (ID) is only stored in one place as opposed to the previous many places.

This was required for the `join_room` action which can be dispatched to join the currently viewed room.

Another change was to introduce `LifeCycleStore` which is a start at encorporating state related to the lifecycle of the app into a flux store. Currently it only contains an action which will be dispatched when the sync state has become PREPARED. This was necessary to do a deferred dispatch of `join_room` following the registration of a PWLU (PassWord-Less User).

The following actions are introduced:
 - RoomViewStore:
    - `view_room`: dispatch to change the currently viewed room ID
    - `join_room`: dispatch to join the currently viewed room
 - LifecycleStore:
    - `do_after_sync_prepared`: dispatch to store an action which will be dispatched when `sync_state` is dispatched with `state = 'PREPARED'`
 - MatrixChat:
    - `sync_state`: dispatched when the sync state changes. Ideally there'd be a SyncStateStore that emitted an `update` upon receiving this, but for now the `LifecycleStore` will listen for `sync_state` directly.
2017-05-24 16:56:13 +01:00
Luke Barnard da3cb0ee48 SessionStore extends flux.Store 2017-05-15 14:52:19 +01:00
Luke Barnard 2b4c87aca6 Remove useless comment 2017-05-12 16:02:38 +01:00
Luke Barnard 536724e7c5 ES6 SessionStore 2017-05-12 15:58:44 +01:00
Luke Barnard 6ffe7ef9b2 Use same singleton impl as MatrixClientPeg for SessionStore 2017-05-12 15:50:01 +01:00
Luke Barnard 1176573f39 Implement SessionStore
This wraps session-related state into a basic flux store. The localStorage item 'mx_pass' is the only thing managed by this store for now but it could easily be extended to track other items (like the teamToken which is passed around through props a lot)
2017-05-12 12:02:45 +01:00