Skip to content
This repository has been archived by the owner on Nov 9, 2021. It is now read-only.

Commit

Permalink
Reload task bar everytime a room is opened
Browse files Browse the repository at this point in the history
  • Loading branch information
mrsimpson committed Feb 19, 2018
1 parent 11d00fe commit 288947f
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 14 deletions.
20 changes: 20 additions & 0 deletions client/config/ui.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import {RocketChat} from 'meteor/rocketchat:lib';

Meteor.startup(function() {
RocketChat.AdminBox.addOption({
href: 'admin-chatpal',
Expand All @@ -14,3 +16,21 @@ Meteor.startup(function() {
template: 'ChatpalSearch'
});
});

RocketChat.callbacks.add('enter-room', () => {
Meteor.call('chatpal.config.get', (err, config) => {
if (err) {
RocketChat.TabBar.updateButton('message-search', {
i18nTitle: 'Search_Messages',
icon: 'magnifier',
template: 'messageSearch'
});
} else if (config.chatpalActivated) {
RocketChat.TabBar.updateButton('message-search', {
i18nTitle: 'CHATPAL_SEARCH',
icon: 'chatpal',
template: 'ChatpalSearch'
});
}
});
}, RocketChat.callbacks.priority.MEDIUM);
14 changes: 0 additions & 14 deletions client/template/admin.js
Original file line number Diff line number Diff line change
Expand Up @@ -142,20 +142,6 @@ Template.ChatpalAdmin.onCreated(function() {
}

toastr.info(TAPi18n.__('CHATPAL_MSG_INFO_CONFIG_STORED_SUCCESSFULLY'));

if (config.chatpalActivated) {
RocketChat.TabBar.updateButton('message-search', {
i18nTitle: 'CHATPAL_SEARCH',
icon: 'chatpal',
template: 'ChatpalSearch'
});
} else {
RocketChat.TabBar.updateButton('message-search', {
i18nTitle: 'Search_Messages',
icon: 'magnifier',
template: 'messageSearch',
});
}
});
};

Expand Down

0 comments on commit 288947f

Please sign in to comment.