Commit 8df53b7e7371e4fd74a8de949eff2e70c8ea0cfb
1 parent
0da7313f
Exists in
master
and in
29 other branches
[tolerance-time] Refactoring and adding ActionTracker exception
Showing
1 changed file
with
7 additions
and
2 deletions
Show diff stats
plugins/tolerance_time/lib/tolerance_time_plugin.rb
@@ -12,9 +12,14 @@ class ToleranceTimePlugin < Noosfero::Plugin | @@ -12,9 +12,14 @@ class ToleranceTimePlugin < Noosfero::Plugin | ||
12 | end | 12 | end |
13 | 13 | ||
14 | def self.expired?(content) | 14 | def self.expired?(content) |
15 | + return false if content.kind_of?(Comment) && !content.article.kind_of?(Article) | ||
16 | + | ||
17 | + expirable = content.kind_of?(Comment) || (!content.folder? && content.published?) | ||
15 | publication = ToleranceTimePlugin::Publication.find_by_target(content) | 18 | publication = ToleranceTimePlugin::Publication.find_by_target(content) |
16 | - (content.kind_of?(Comment) || (!content.folder? && content.published?)) && | ||
17 | - ((!publication.present? && !content.profile.kind_of?(Person)) || (publication.present? && publication.expired?)) | 19 | + publication = ToleranceTimePlugin::Publication.create!(:target => content) if expirable && publication.nil? |
20 | + person_article = content.kind_of?(Article) && content.profile.kind_of?(Person) | ||
21 | + | ||
22 | + !person_article && expirable && publication.expired? | ||
18 | end | 23 | end |
19 | 24 | ||
20 | def control_panel_buttons | 25 | def control_panel_buttons |