Commit 3c94729bc1231c1a23209fc6ca3aeaed5a29534d

Authored by Braulio Bhavamitra
1 parent da84575e

plugins: revert change on pipeline

Showing 1 changed file with 3 additions and 2 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 - map { |plugin| plugin.class if result_for plugin, event, *args }.compact.flatten 27 + flat_map{ |plugin| plugin.class if result_for plugin, event, *args }.compact
28 end 28 end
29 29
30 def dispatch_without_flatten(event, *args) 30 def dispatch_without_flatten(event, *args)
@@ -60,7 +60,8 @@ class Noosfero::Plugin::Manager @@ -60,7 +60,8 @@ 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 = result_for plugin, event, *args 63 + # result_for can't be used here and default must be returned to keep args
  64 + result = plugin.send event, *args
64 result = result.kind_of?(Array) ? result : [result] 65 result = result.kind_of?(Array) ? result : [result]
65 raise ArgumentError, "Pipeline broken by #{plugin.class.name} on #{event} with #{result.length} arguments instead of #{args.length}." if result.length != args.length 66 raise ArgumentError, "Pipeline broken by #{plugin.class.name} on #{event} with #{result.length} arguments instead of #{args.length}." if result.length != args.length
66 args = result 67 args = result