Commit afbebeee18b5e35e3ae7d8e483b6f59d6d2cc304

Authored by Larissa Reis
1 parent c5265b67

[tolerance-time-plugin] Change lambda to proc

  Part of rails 3 migration

  Also removes useless line. The check for enabled plugin is made before
  adding the filter. Besides, that proc was never called.
plugins/tolerance_time/lib/tolerance_time_plugin.rb
@@ -28,8 +28,7 @@ class ToleranceTimePlugin < Noosfero::Plugin @@ -28,8 +28,7 @@ class ToleranceTimePlugin < Noosfero::Plugin
28 end 28 end
29 29
30 def cms_controller_filters 30 def cms_controller_filters
31 - p = Proc.new { |context| return if !context.environment.plugin_enabled?(ToleranceTimePlugin) }  
32 - block = lambda do 31 + block = proc do
33 content = Article.find(params[:id]) 32 content = Article.find(params[:id])
34 if ToleranceTimePlugin.expired?(content) 33 if ToleranceTimePlugin.expired?(content)
35 session[:notice] = _("This content can't be edited anymore because it expired the tolerance time") 34 session[:notice] = _("This content can't be edited anymore because it expired the tolerance time")
@@ -43,8 +42,7 @@ class ToleranceTimePlugin < Noosfero::Plugin @@ -43,8 +42,7 @@ class ToleranceTimePlugin < Noosfero::Plugin
43 end 42 end
44 43
45 def content_viewer_controller_filters 44 def content_viewer_controller_filters
46 - p = Proc.new { |context| return if !context.environment.plugin_enabled?(ToleranceTimePlugin) }  
47 - block = lambda do 45 + block = proc do
48 content = Comment.find(params[:id]) 46 content = Comment.find(params[:id])
49 if ToleranceTimePlugin.expired?(content) 47 if ToleranceTimePlugin.expired?(content)
50 session[:notice] = _("This content can't be edited anymore because it expired the tolerance time") 48 session[:notice] = _("This content can't be edited anymore because it expired the tolerance time")