Commit 3e99a558261678f01c6d69b6053d4394adbea68b
1 parent
81478cba
Exists in
master
and in
26 other branches
Revert "plugins: revert change on pipeline"
This reverts commit 3c94729bc1231c1a23209fc6ca3aeaed5a29534d.
Showing
1 changed file
with
2 additions
and
3 deletions
Show diff stats
lib/noosfero/plugin/manager.rb
@@ -24,7 +24,7 @@ class Noosfero::Plugin::Manager | @@ -24,7 +24,7 @@ class Noosfero::Plugin::Manager | ||
24 | end | 24 | end |
25 | 25 | ||
26 | def fetch_plugins(event, *args) | 26 | def fetch_plugins(event, *args) |
27 | - flat_map{ |plugin| plugin.class if result_for plugin, event, *args }.compact | 27 | + map { |plugin| plugin.class if result_for plugin, event, *args }.compact.flatten |
28 | end | 28 | end |
29 | 29 | ||
30 | def dispatch_without_flatten(event, *args) | 30 | def dispatch_without_flatten(event, *args) |
@@ -60,8 +60,7 @@ class Noosfero::Plugin::Manager | @@ -60,8 +60,7 @@ class Noosfero::Plugin::Manager | ||
60 | 60 | ||
61 | def pipeline(event, *args) | 61 | def pipeline(event, *args) |
62 | each do |plugin| | 62 | each do |plugin| |
63 | - # result_for can't be used here and default must be returned to keep args | ||
64 | - result = plugin.send event, *args | 63 | + result = result_for plugin, event, *args |
65 | result = result.kind_of?(Array) ? result : [result] | 64 | result = result.kind_of?(Array) ? result : [result] |
66 | raise ArgumentError, "Pipeline broken by #{plugin.class.name} on #{event} with #{result.length} arguments instead of #{args.length}." if result.length != args.length | 65 | raise ArgumentError, "Pipeline broken by #{plugin.class.name} on #{event} with #{result.length} arguments instead of #{args.length}." if result.length != args.length |
67 | args = result | 66 | args = result |