From 40c7cdd7c821895489c33cc851f2e5c00af806f7 Mon Sep 17 00:00:00 2001 From: yflory Date: Mon, 10 Sep 2018 18:16:24 +0200 Subject: [PATCH] Fix an issue with messenger while opening the same tab twice --- www/common/common-messenger.js | 6 ++++++ www/contacts/messenger-ui.js | 1 + 2 files changed, 7 insertions(+) diff --git a/www/common/common-messenger.js b/www/common/common-messenger.js index 0872b0585..e0467f548 100644 --- a/www/common/common-messenger.js +++ b/www/common/common-messenger.js @@ -853,6 +853,12 @@ define([ var openPadChat = function (data, cb) { var channel = data.channel; + if (getChannel(channel)) { + eachHandler('event', function (f) { + f('PADCHAT_READY', channel); + }); + return void cb(); + } var keys = data.secret && data.secret.keys; var cryptKey = keys.viewKeyStr ? Crypto.b64AddSlashes(keys.viewKeyStr) : data.secret.key; var encryptor = Crypto.createEncryptor(cryptKey); diff --git a/www/contacts/messenger-ui.js b/www/contacts/messenger-ui.js index 9882ea157..5cf793f52 100644 --- a/www/contacts/messenger-ui.js +++ b/www/contacts/messenger-ui.js @@ -708,6 +708,7 @@ define([ var onPadChatReady = function (data) { var padChat = common.getPadChat(); if (data !== padChat) { return; } + if (state.channels[data]) { return; } execCommand('GET_ROOMS', {padChat: data}, function (err, rooms) { if (err) { return void console.error(err); } if (!Array.isArray(rooms) || rooms.length !== 1) {