diff --git a/public/src/client/chats.js b/public/src/client/chats.js index 7b9131cf05..d4f9afcfd1 100644 --- a/public/src/client/chats.js +++ b/public/src/client/chats.js @@ -29,13 +29,13 @@ define('forum/chats', [ Chats.addEventListeners(); Chats.createTagsInput($('[component="chat/messages"] .users-tag-input'), ajaxify.data); Chats.createAutoComplete($('[component="chat/input"]')); + Chats.resizeMainWindow(); components.get('expanded-chat/controlsToggle').on('click', function () { components.get('expanded-chat/controls').toggleClass('hide'); }); if (env === 'md' || env === 'lg') { - Chats.resizeMainWindow(); Chats.addHotkeys(); } @@ -409,7 +409,7 @@ define('forum/chats', [ Chats.resizeMainWindow = function () { var viewportHeight = $(window).height(); - var fromTop = components.get('chat/nav-wrapper').offset().top; + var fromTop = components.get('chat/main-wrapper').offset().top || components.get('chat/nav-wrapper').offset().top; $('.chats-full').height(viewportHeight - fromTop); Chats.setActive(); @@ -422,6 +422,8 @@ define('forum/chats', [ } $('.chats-list li').removeClass('bg-info'); $('.chats-list li[data-roomid="' + ajaxify.data.roomId + '"]').addClass('bg-info'); + + components.get('chat/nav-wrapper').attr('data-loaded', ajaxify.data.roomId ? '1' : '0'); }; diff --git a/public/src/client/chats/recent.js b/public/src/client/chats/recent.js index 51650c8795..7d6f16211a 100644 --- a/public/src/client/chats/recent.js +++ b/public/src/client/chats/recent.js @@ -12,12 +12,7 @@ define('forum/chats/recent', function () { }); $('[component="chat/recent"]').on('click', '[component="chat/recent/room"]', function () { - var env = utils.findBootstrapEnvironment(); - if (env === 'xs' || env === 'sm') { - app.openChat($(this).attr('data-roomid')); - } else { - Chats.switchChat($(this).attr('data-roomid')); - } + Chats.switchChat($(this).attr('data-roomid')); }); $('[component="chat/recent"]').on('scroll', function () {