From beafb68538932380fd2c0d351d8213cd32f57b8b Mon Sep 17 00:00:00 2001 From: Luke Barnard Date: Mon, 5 Jun 2017 13:14:55 +0100 Subject: [PATCH] Don't do a deferred start chat if user is welcome user There's no point in deferring creating a new DM with the welcome user because the setMxId dialog will do so anyway. --- src/components/structures/MatrixChat.js | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/src/components/structures/MatrixChat.js b/src/components/structures/MatrixChat.js index 5791ffe49a..c376244d2a 100644 --- a/src/components/structures/MatrixChat.js +++ b/src/components/structures/MatrixChat.js @@ -721,13 +721,17 @@ module.exports = React.createClass({ ); // Use a deferred action to reshow the dialog once the user has registered if (MatrixClientPeg.get().isGuest()) { - dis.dispatch({ - action: 'do_after_sync_prepared', - deferred_action: { - action: 'view_start_chat_or_reuse', - user_id: userId, - }, - }); + // No point in making 2 DMs with welcome bot. This assumes view_set_mxid will + // result in a new DM with the welcome user. + if (userId !== this.props.config.welcomeUserId) { + dis.dispatch({ + action: 'do_after_sync_prepared', + deferred_action: { + action: 'view_start_chat_or_reuse', + user_id: userId, + }, + }); + } dis.dispatch({ action: 'view_set_mxid', });