Commit 8674ccd1a2998e3f16e29d8fa0bfce558ed4d7bc
1 parent
a405a4a6
Exists in
master
and in
29 other branches
tolerance-time: Proc to fix (undefined method 'environment' for nil:nilClass)
Showing
1 changed file
with
2 additions
and
3 deletions
Show diff stats
plugins/tolerance_time/lib/tolerance_time_plugin.rb
@@ -28,7 +28,7 @@ class ToleranceTimePlugin < Noosfero::Plugin | @@ -28,7 +28,7 @@ class ToleranceTimePlugin < Noosfero::Plugin | ||
28 | end | 28 | end |
29 | 29 | ||
30 | def cms_controller_filters | 30 | def cms_controller_filters |
31 | - return if !context.environment.plugin_enabled?(ToleranceTimePlugin) | 31 | + p = Proc.new { |context| return if !context.environment.plugin_enabled?(ToleranceTimePlugin) } |
32 | block = lambda do | 32 | block = lambda do |
33 | content = Article.find(params[:id]) | 33 | content = Article.find(params[:id]) |
34 | if ToleranceTimePlugin.expired?(content) | 34 | if ToleranceTimePlugin.expired?(content) |
@@ -36,7 +36,6 @@ class ToleranceTimePlugin < Noosfero::Plugin | @@ -36,7 +36,6 @@ class ToleranceTimePlugin < Noosfero::Plugin | ||
36 | redirect_to content.url | 36 | redirect_to content.url |
37 | end | 37 | end |
38 | end | 38 | end |
39 | - | ||
40 | { :type => 'before_filter', | 39 | { :type => 'before_filter', |
41 | :method_name => 'expired_content', | 40 | :method_name => 'expired_content', |
42 | :options => {:only => 'edit'}, | 41 | :options => {:only => 'edit'}, |
@@ -44,7 +43,7 @@ class ToleranceTimePlugin < Noosfero::Plugin | @@ -44,7 +43,7 @@ class ToleranceTimePlugin < Noosfero::Plugin | ||
44 | end | 43 | end |
45 | 44 | ||
46 | def content_viewer_controller_filters | 45 | def content_viewer_controller_filters |
47 | - return if !context.environment.plugin_enabled?(ToleranceTimePlugin) | 46 | + p = Proc.new { |context| return if !context.environment.plugin_enabled?(ToleranceTimePlugin) } |
48 | block = lambda do | 47 | block = lambda do |
49 | content = Comment.find(params[:id]) | 48 | content = Comment.find(params[:id]) |
50 | if ToleranceTimePlugin.expired?(content) | 49 | if ToleranceTimePlugin.expired?(content) |