From fd4a62740a56a0c68c2e4d109d1e3a046a447b85 Mon Sep 17 00:00:00 2001 From: Simon Grim Date: Sat, 2 Feb 2019 15:10:45 +0500 Subject: [PATCH] add a hack to not open DM related modals until twister.DMs will be initializated --- js/twister_directmsg.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/js/twister_directmsg.js b/js/twister_directmsg.js index f354770..0858d5e 100644 --- a/js/twister_directmsg.js +++ b/js/twister_directmsg.js @@ -68,6 +68,11 @@ function openCommonDMsModal() { return; } + if ($.isEmptyObject(twister.DMs)) { + setTimeout(openCommonDMsModal, 1000); + return; + } + var modal = openModal({ classAdd: 'directMessages', content: twister.tmpl.commonDMsList.clone(true), @@ -94,6 +99,11 @@ function openDmWithUserModal(peerAlias) { return; } + if ($.isEmptyObject(twister.DMs)) { + setTimeout(openDmWithUserModal, 1000, peerAlias); + return; + } + var modal = openModal({ classAdd: 'directMessages', content: $('.messages-thread-template').children().clone(true), @@ -134,6 +144,11 @@ function openGroupMessagesModal(groupAlias) { return; } + if ($.isEmptyObject(twister.DMs)) { + setTimeout(openGroupMessagesModal, 1000, groupAlias); + return; + } + if (typeof groupAlias === 'undefined') { var modal = openModal({ classAdd: 'directMessages groupMessages',