Fix an issue with messenger while opening the same tab twice

pull/1/head
yflory 6 years ago
parent 216c94b1f0
commit 40c7cdd7c8

@ -853,6 +853,12 @@ define([
var openPadChat = function (data, cb) { var openPadChat = function (data, cb) {
var channel = data.channel; 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 keys = data.secret && data.secret.keys;
var cryptKey = keys.viewKeyStr ? Crypto.b64AddSlashes(keys.viewKeyStr) : data.secret.key; var cryptKey = keys.viewKeyStr ? Crypto.b64AddSlashes(keys.viewKeyStr) : data.secret.key;
var encryptor = Crypto.createEncryptor(cryptKey); var encryptor = Crypto.createEncryptor(cryptKey);

@ -708,6 +708,7 @@ define([
var onPadChatReady = function (data) { var onPadChatReady = function (data) {
var padChat = common.getPadChat(); var padChat = common.getPadChat();
if (data !== padChat) { return; } if (data !== padChat) { return; }
if (state.channels[data]) { return; }
execCommand('GET_ROOMS', {padChat: data}, function (err, rooms) { execCommand('GET_ROOMS', {padChat: data}, function (err, rooms) {
if (err) { return void console.error(err); } if (err) { return void console.error(err); }
if (!Array.isArray(rooms) || rooms.length !== 1) { if (!Array.isArray(rooms) || rooms.length !== 1) {

Loading…
Cancel
Save