...
 
Commits (3)
......@@ -2,7 +2,7 @@ import { Template } from 'meteor/templating';
import { SideNav, Layout } from '../../../../ui-utils';
import { t } from '../../../../utils';
import { hasAtLeastOnePermission } from '../../../../authorization';
import { hasPermission } from '../../../../authorization';
import './livechatFlex.html';
import { sidebarItems } from './livechatSideNavItems';
......@@ -21,9 +21,10 @@ Template.livechatFlex.helpers({
sidebarItems() {
const items = sidebarItems.get();
const newItems = [];
for (const item of items) {
if (item.permission) {
if (!hasAtLeastOnePermission(item.permission)) {
if (!hasPermission(item.permission)) {
continue;
}
}
......@@ -34,7 +35,7 @@ Template.livechatFlex.helpers({
});
}
return sidebarItems.get();
return newItems;
},
});
......
import { ReactiveVar } from 'meteor/reactive-var';
export const sidebarItems = new ReactiveVar([]);
export const addSidebarItem = (title, slug, permission) => {
sidebarItems.set([
......
......@@ -15,5 +15,6 @@ Meteor.publish('livechat:departments', function(filter = {}, limit = 50) {
if (filter && filter._id) {
return LivechatDepartment.findByDepartmentId(filter._id);
}
return LivechatDepartment.find({}, { limit });
});