Skip to content
This repository was archived by the owner on Sep 11, 2024. It is now read-only.

Commit ecc8abb

Browse files
author
Luke Barnard
committed
When ChatCreateOrReuseDialog is cancelled by a guest, go home
1 parent 924c08b commit ecc8abb

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

src/components/structures/MatrixChat.js

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -466,7 +466,7 @@ module.exports = React.createClass({
466466
this.notifyNewScreen('home');
467467
break;
468468
case 'view_set_mxid':
469-
this._setMxId();
469+
this._setMxId(payload);
470470
break;
471471
case 'view_start_chat_or_reuse':
472472
this._chatCreateOrReuse(payload.user_id);
@@ -680,7 +680,7 @@ module.exports = React.createClass({
680680
});
681681
},
682682

683-
_setMxId: function() {
683+
_setMxId: function(payload) {
684684
const SetMxIdDialog = sdk.getComponent('views.dialogs.SetMxIdDialog');
685685
const close = Modal.createDialog(SetMxIdDialog, {
686686
homeserverUrl: MatrixClientPeg.get().getHomeserverUrl(),
@@ -689,6 +689,11 @@ module.exports = React.createClass({
689689
dis.dispatch({
690690
action: 'cancel_after_sync_prepared',
691691
});
692+
if (payload.go_home_on_cancel) {
693+
dis.dispatch({
694+
action: 'view_home_page',
695+
});
696+
}
692697
return;
693698
}
694699
this.onRegistered(credentials);
@@ -769,6 +774,11 @@ module.exports = React.createClass({
769774
}
770775
dis.dispatch({
771776
action: 'view_set_mxid',
777+
// If the set_mxid dialog is cancelled, view /home because if the browser
778+
// was pointing at /user/@someone:domain?action=chat, the URL needs to be
779+
// reset so that they can revisit /user/.. // (and trigger
780+
// `_chatCreateOrReuse` again)
781+
go_home_on_cancel: true,
772782
});
773783
return;
774784
}

0 commit comments

Comments
 (0)