Skip to content

Commit

Permalink
Merge pull request #7561 from RocketChat/close-flextab-on-leave-room-…
Browse files Browse the repository at this point in the history
…mobile

[NEW] Closes tab bar on mobile when leaving room
  • Loading branch information
rodrigok authored Jul 26, 2017
2 parents 22e6116 + 4a8ea9c commit 978474e
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 0 deletions.
5 changes: 5 additions & 0 deletions packages/rocketchat-lib/client/lib/roomExit.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
/*globals currentTracker */
this.roomExit = function() {
// 7370 - Close flex-tab when opening a room on mobile UI
if (window.matchMedia('(max-width: 500px)').matches) {
const templateData = Blaze.getData(document.querySelector('.flex-tab'));
templateData && templateData.tabBar && templateData.tabBar.close();
}
RocketChat.callbacks.run('roomExit');
BlazeLayout.render('main', {
center: 'none'
Expand Down
3 changes: 3 additions & 0 deletions packages/rocketchat-mentions-flextab/client/actionButton.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ Meteor.startup(function() {
action() {
const message = this._arguments[1];
RocketChat.MessageAction.hideDropDown();
if (window.matchMedia('(max-width: 500px)').matches) {
Template.instance().tabBar.close();
}
return RoomHistoryManager.getSurroundingMessages(message, 50);
},
validation(message) {
Expand Down
3 changes: 3 additions & 0 deletions packages/rocketchat-message-pin/client/actionButton.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,9 @@ Meteor.startup(function() {
action() {
const message = this._arguments[1];
RocketChat.MessageAction.hideDropDown();
if (window.matchMedia('(max-width: 500px)').matches) {
Template.instance().tabBar.close();
}
return RoomHistoryManager.getSurroundingMessages(message, 50);
},
validation(message) {
Expand Down
3 changes: 3 additions & 0 deletions packages/rocketchat-message-star/client/actionButton.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@ Meteor.startup(function() {
action() {
const message = this._arguments[1];
RocketChat.MessageAction.hideDropDown();
if (window.matchMedia('(max-width: 500px)').matches) {
Template.instance().tabBar.close();
}
return RoomHistoryManager.getSurroundingMessages(message, 50);
},
validation(message) {
Expand Down
3 changes: 3 additions & 0 deletions packages/rocketchat-ui-flextab/client/tabs/messageSearch.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ Meteor.startup(function() {
action() {
const message = this._arguments[1];
RocketChat.MessageAction.hideDropDown();
if (window.matchMedia('(max-width: 500px)').matches) {
Template.instance().tabBar.close();
}
return RoomHistoryManager.getSurroundingMessages(message, 50);
},
order: 100
Expand Down

0 comments on commit 978474e

Please sign in to comment.