]> source.dussan.org Git - nextcloud-server.git/commitdiff
Make sure each plugin is only added once
authorJoas Schilling <coding@schilljs.com>
Wed, 27 Jul 2016 13:17:09 +0000 (15:17 +0200)
committerJoas Schilling <coding@schilljs.com>
Wed, 3 Aug 2016 12:39:56 +0000 (14:39 +0200)
apps/workflowengine/js/admin.js

index 48d1592b4571a0b2a4c77da46a87c0ff65bab365..b9f0744732ffeb95896fb0af780ac596284b7347 100644 (file)
                        }
                });
 
-       /**
-        * @class OCA.WorkflowEngine.AvailableCheck
-        */
-       OCA.WorkflowEngine.AvailableCheck =
-               OC.Backbone.Model.extend({});
-
        /**
         *  .d8888b.           888 888                   888    d8b
         * d88P  Y88b          888 888                   888    Y8P
                                this._initialize('OCA\\WorkflowEngine\\Operation');
                        },
                        _initialize: function(classname) {
-                               OCA.WorkflowEngine.availablePlugins = OC.Plugins.getPlugins('OCA.WorkflowEngine.CheckPlugins');
-                               _.each(OCA.WorkflowEngine.availablePlugins, function(plugin) {
-                                       if (_.isFunction(plugin.getCheck)) {
-                                               OCA.WorkflowEngine.availableChecks.push(plugin.getCheck());
-                                       }
-                               });
+                               if (!OCA.WorkflowEngine.availablePlugins.length) {
+                                       OCA.WorkflowEngine.availablePlugins = OC.Plugins.getPlugins('OCA.WorkflowEngine.CheckPlugins');
+                                       _.each(OCA.WorkflowEngine.availablePlugins, function(plugin) {
+                                               if (_.isFunction(plugin.getCheck)) {
+                                                       OCA.WorkflowEngine.availableChecks.push(plugin.getCheck(classname));
+                                               }
+                                       });
+                               }
 
                                this.collection.fetch({data: {
                                        'class': classname