From 2e322cf66f98d927ca6a988eee1be7717a73ac9f Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Tue, 15 Jan 2019 17:05:13 +0300 Subject: [PATCH] Hide plugins tab when no visible plugins (e.g., editor has only editing plugins but is opened in viewer mode) --- apps/common/main/lib/collection/Plugins.js | 6 +++++- apps/common/main/lib/controller/Plugins.js | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/apps/common/main/lib/collection/Plugins.js b/apps/common/main/lib/collection/Plugins.js index 16f491e64..cd943fc31 100644 --- a/apps/common/main/lib/collection/Plugins.js +++ b/apps/common/main/lib/collection/Plugins.js @@ -49,6 +49,10 @@ define([ 'use strict'; Common.Collections.Plugins = Backbone.Collection.extend({ - model: Common.Models.Plugin + model: Common.Models.Plugin, + + hasVisible: function() { + return !!this.findWhere({visible: true}); + } }); }); diff --git a/apps/common/main/lib/controller/Plugins.js b/apps/common/main/lib/controller/Plugins.js index 2b9f71a61..483c113eb 100644 --- a/apps/common/main/lib/controller/Plugins.js +++ b/apps/common/main/lib/controller/Plugins.js @@ -174,7 +174,7 @@ define([ arr.push(plugin); }); this.api.asc_pluginsRegister('', arr); - if (storePlugins.length>0) + if (storePlugins.hasVisible()) Common.NotificationCenter.trigger('tab:visible', 'plugins', true); },