Author: Hugo Melo <hugo@riseup.net>
Merge branch 'master' of github.com:samasti/noosfero
app/concerns/find_by_contents.rb | 2 +- config/spring.rb | 2 +- lib/noosfero/plugin/manager.rb | 22 ++++++++++------------
diff --git a/app/concerns/find_by_contents.rb b/app/concerns/find_by_contents.rb index 3b952cf62af8a8b47be1742f1b0ca98d69a6ecdd..2c1eab288993da8728e7614ec4f1ad6b6fcc6426 100644 --- a/app/concerns/find_by_contents.rb +++ b/app/concerns/find_by_contents.rb @@ -19,7 +19,7 @@ def find_by_contents(asset, context, scope, query, paginate_options={:page => 1}, options={}) scope = scope.with_templates(options[:template_id]) unless options[:template_id].blank? search = plugins.dispatch_first(:find_by_contents, asset, scope, query, paginate_options, options) - register_search_term(query, scope.count, search[:results].count, context, asset) + #register_search_term(query, scope.count, search[:results].count, context, asset) search end diff --git a/config/spring.rb b/config/spring.rb index d008a3ef2dbbd86e79f58b6479fd9b912139bf67..f0bcfd0a8968314f9de328d558422683560dd84a 100644 --- a/config/spring.rb +++ b/config/spring.rb @@ -3,7 +3,7 @@ .env .env.local .ruby-version .rbenv-vars - lib + lib/** tmp/restart.txt tmp/caching-dev.txt db/migrate diff --git a/lib/noosfero/plugin/manager.rb b/lib/noosfero/plugin/manager.rb index e1ac12634f2928e97a09af55efa5eeda4cb9bd04..b0da43a2cf59a9d665d603ee55926395a2d6cc82 100644 --- a/lib/noosfero/plugin/manager.rb +++ b/lib/noosfero/plugin/manager.rb @@ -34,25 +34,23 @@ alias :dispatch_scopes :dispatch_without_flatten def dispatch_first(event, *args) - default = Noosfero::Plugin.new.send(event, *args) - result = default each do |plugin| - result = plugin.send(event, *args) - break if result != default + method = plugin.method event + next unless method.owner == plugin.class + return method.call(*args) end - result + return Noosfero::Plugin.new.send event, *args end def fetch_first_plugin(event, *args) - default = Noosfero::Plugin.new.send(event, *args) - result = nil + default = Noosfero::Plugin.new.send event, *args each do |plugin| - if plugin.send(event, *args) != default - result = plugin.class - break - end + method = plugin.method event + next unless method.owner == plugin.class + next unless method.call(*args) != default + return plugin.class end - result + nil end def pipeline(event, *args)