Skip to content

Commit

Permalink
[FIX] Files list missing from popover menu when owner of room (#11565)
Browse files Browse the repository at this point in the history
[FIX] Files list missing from popover menu when owner of room
  • Loading branch information
tassoevan authored and geekgonecrazy committed Sep 27, 2018
1 parent 21e9804 commit 9328207
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 25 deletions.
Empty file.
52 changes: 27 additions & 25 deletions packages/rocketchat-ui-flextab/client/flexTabBar.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,63 +79,63 @@ Template.flexTabBar.helpers({
});

const commonEvents = {
'click .js-action'(e, instance) {
'click .js-action'(e, t) {
$('button', e.currentTarget).blur();
e.preventDefault();
const $flexTab = $('.flex-tab-container .flex-tab');

if (instance.tabBar.getState() === 'opened' && instance.tabBar.getTemplate() === this.template) {
if (t.tabBar.getState() === 'opened' && t.tabBar.getTemplate() === this.template) {
$flexTab.attr('template', '');
return instance.tabBar.close();
return t.tabBar.close();
}

$flexTab.attr('template', this.template);
instance.tabBar.setData({
t.tabBar.setData({
label: this.i18nTitle,
icon: this.icon,
});
instance.tabBar.open(this);
t.tabBar.open(this);

popover.close();
},
};
const action = function(e, instance) {
const action = function(e, t) {
$('button', e.currentTarget).blur();
e.preventDefault();
const $flexTab = $('.flex-tab-container .flex-tab');

if (instance.tabBar.getState() === 'opened' && instance.tabBar.getTemplate() === this.template) {
if (t.tabBar.getState() === 'opened' && t.tabBar.getTemplate() === this.template) {
$flexTab.attr('template', '');
return instance.tabBar.close();
return t.tabBar.close();
}

$flexTab.attr('template', this.template);
instance.tabBar.setData({
t.tabBar.setData({
label: this.i18nTitle,
icon: this.icon,
});
instance.tabBar.open(this);
t.tabBar.open(this);

popover.close();
};

Template.flexTabBar.events({
'click .tab-button'(e, instance) {
'click .tab-button'(e, t) {
e.preventDefault();
const $flexTab = $('.flex-tab-container .flex-tab');

if (instance.tabBar.getState() === 'opened' && instance.tabBar.getTemplate() === this.template) {
if (t.tabBar.getState() === 'opened' && t.tabBar.getTemplate() === this.template) {
$flexTab.attr('template', '');
return instance.tabBar.close();
return t.tabBar.close();
}

$flexTab.attr('template', this.template);

instance.tabBar.open(this.id);
t.tabBar.open(this.id);
},

'click .close-flex-tab'(event, instance) {
instance.tabBar.close();
'click .close-flex-tab'(event, t) {
t.tabBar.close();
},
});

Expand All @@ -159,11 +159,11 @@ Template.RoomsActionMore.onCreated(function() {

Template.RoomsActionTab.events({
...commonEvents,
'click .js-more'(e, instance) {
'click .js-more'(e, t) {
$(e.currentTarget).blur();
e.preventDefault();
const buttons = RocketChat.TabBar.getButtons().filter((button) => filterButtons(button, instance.anonymous, instance.data.rid));
const groups = [{ items:(instance.small.get() ? buttons : buttons.slice(RocketChat.TabBar.size)).map((item) => {
const buttons = RocketChat.TabBar.getButtons().filter((button) => filterButtons(button, t.anonymous, t.data.rid));
const groups = [{ items:(t.small.get() ? buttons : buttons.slice(RocketChat.TabBar.size)).map((item) => {
item.name = TAPi18n.__(item.i18nTitle);
item.action = action;
return item;
Expand All @@ -175,8 +175,8 @@ Template.RoomsActionTab.events({
popoverClass: 'message-box',
data: {
rid: this._id,
buttons: instance.small.get() ? buttons : buttons.slice(RocketChat.TabBar.size),
tabBar: instance.tabBar,
buttons: t.small.get() ? buttons : buttons.slice(RocketChat.TabBar.size),
tabBar: t.tabBar,
},
currentTarget: e.currentTarget,
offsetHorizontal: -e.currentTarget.clientWidth,
Expand All @@ -201,10 +201,12 @@ Template.RoomsActionTab.onCreated(function() {

Template.RoomsActionTab.helpers({
...commonHelpers,

postButtons() {
const toolbar = Session.get('toolbarButtons') || {};
return Object.keys(toolbar.buttons || []).map((key) => ({ id: key, ...toolbar.buttons[key] }));
},

active() {
if (this.template === Template.instance().tabBar.getTemplate() && Template.instance().tabBar.getState() === 'opened') {
return 'active';
Expand All @@ -215,17 +217,17 @@ Template.RoomsActionTab.helpers({
if (Template.instance().small.get()) {
return [];
}
const buttons = RocketChat.TabBar.getButtons().filter((button) => filterButtons(button, this.anonymous, this.data.rid));
const buttons = RocketChat.TabBar.getButtons()
.filter((button) => filterButtons(button, Template.instance().anonymous, Template.instance().data.rid));
return buttons.length <= RocketChat.TabBar.size ? buttons : buttons.slice(0, RocketChat.TabBar.size);
},

moreButtons() {
if (Template.instance().small.get()) {
return true;
}
const buttons = RocketChat.TabBar.getButtons().filter((button) =>
filterButtons(button, this.anonymous, this.data.rid)
);
const buttons = RocketChat.TabBar.getButtons()
.filter((button) => filterButtons(button, Template.instance().anonymous, Template.instance().data.rid));
return buttons.length > RocketChat.TabBar.size;
},
});

0 comments on commit 9328207

Please sign in to comment.