Commit Graph

349 Commits (8254261f261006740cc53ff6ea0602f14aac4562)

Author SHA1 Message Date
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