Make sure each plugin is only added once

This commit is contained in:
Joas Schilling 2016-07-27 15:17:09 +02:00
parent 8a7d450fb5
commit 6430164a09
No known key found for this signature in database
GPG Key ID: E166FD8976B3BAC8
1 changed files with 8 additions and 12 deletions

View File

@ -74,12 +74,6 @@
}
});
/**
* @class OCA.WorkflowEngine.AvailableCheck
*/
OCA.WorkflowEngine.AvailableCheck =
OC.Backbone.Model.extend({});
/**
* .d8888b. 888 888 888 d8b
* d88P Y88b 888 888 888 Y8P
@ -335,12 +329,14 @@
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