[noosfero/noosfero][master] plugins: revert change on pipeline

Bráulio Bhavamitra gitlab at gitlab.com
Sat Mar 28 10:15:43 BRT 2015


Bráulio Bhavamitra pushed to master at Noosfero / noosfero


Commits:
3c94729b by Braulio Bhavamitra at 2015-03-28T10:15:29Z
plugins: revert change on pipeline

- - - - -


1 changed file:

- lib/noosfero/plugin/manager.rb


Changes:

=====================================
lib/noosfero/plugin/manager.rb
=====================================
--- a/lib/noosfero/plugin/manager.rb
+++ b/lib/noosfero/plugin/manager.rb
@@ -24,7 +24,7 @@ class Noosfero::Plugin::Manager
   end
 
   def fetch_plugins(event, *args)
-    map { |plugin| plugin.class if result_for plugin, event, *args }.compact.flatten
+    flat_map{ |plugin| plugin.class if result_for plugin, event, *args }.compact
   end
 
   def dispatch_without_flatten(event, *args)
@@ -60,7 +60,8 @@ class Noosfero::Plugin::Manager
 
   def pipeline(event, *args)
     each do |plugin|
-      result = result_for plugin, event, *args
+      # result_for can't be used here and default must be returned to keep args
+      result = plugin.send event, *args
       result = result.kind_of?(Array) ? result : [result]
       raise ArgumentError, "Pipeline broken by #{plugin.class.name} on #{event} with #{result.length} arguments instead of #{args.length}." if result.length != args.length
       args = result


View it on GitLab: https://gitlab.com/noosfero/noosfero/commit/3c94729bc1231c1a23209fc6ca3aeaed5a29534d
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listas.softwarelivre.org/pipermail/noosfero-dev/attachments/20150328/c38d9c40/attachment.html>


More information about the Noosfero-dev mailing list