Implement basic soft logout handling

Fixes https://github.com/vector-im/riot-web/issues/10235

CSS and copy are left as an exercise for a later iteration.

Login page handling is left for https://github.com/vector-im/riot-web/issues/10236

This implementation reuses as much of the Lifecycle flow as it can without causing problems. Most importantly, it requires https://github.com/matrix-org/matrix-js-sdk/pull/975 to be able to detect a soft logout and react to it. When it comes time to starting/stopping the Lifecycle, additional parameters are provided so that the auxiliary services can (re)start themselves without the client starting to sync.
This commit is contained in:
Travis Ralston 2019-07-03 16:46:37 -06:00
parent 668d24111c
commit 42e6287bdb
12 changed files with 286 additions and 8 deletions

View file

@ -122,6 +122,7 @@ class CustomRoomTagStore extends EventEmitter {
}
}
break;
case 'on_client_not_viable':
case 'on_logged_out': {
// we assume to always have a tags object in the state
this._state = {tags: {}};

View file

@ -63,6 +63,7 @@ class LifecycleStore extends Store {
dis.dispatch(deferredAction);
break;
}
case 'on_client_not_viable':
case 'on_logged_out':
this.reset();
break;

View file

@ -261,6 +261,7 @@ class RoomListStore extends Store {
// console.log("!! Optimistic tag failure: ", payload);
// }
// break;
case 'on_client_not_viable':
case 'on_logged_out': {
// Reset state without pushing an update to the view, which generally assumes that
// the matrix client isn't `null` and so causing a re-render will cause NPEs.

View file

@ -103,6 +103,7 @@ class RoomViewStore extends Store {
case 'join_room_error':
this._joinRoomError(payload);
break;
case 'on_client_not_viable':
case 'on_logged_out':
this.reset();
break;

View file

@ -68,6 +68,7 @@ class SessionStore extends Store {
cachedPassword: null,
});
break;
case 'on_client_not_viable':
case 'on_logged_out':
this._setState({
cachedPassword: null,

View file

@ -166,6 +166,7 @@ class TagOrderStore extends Store {
});
Analytics.trackEvent('FilterStore', 'deselect_tags');
break;
case 'on_client_not_viable':
case 'on_logged_out': {
// Reset state without pushing an update to the view, which generally assumes that
// the matrix client isn't `null` and so causing a re-render will cause NPEs.