Commit f9ce8de3a87520d7731d34d33eebb49317768621
1 parent
bfc59d81
Exists in
master
and in
29 other branches
action_tracker_ext: skip activity creation without a target
This avoid crashes against a database where I was testing upgrades from Noosfero 1.2
Showing
1 changed file
with
1 additions
and
0 deletions
Show diff stats
lib/noosfero/action_tracker_ext.rb
@@ -27,6 +27,7 @@ Rails.configuration.to_prepare do | @@ -27,6 +27,7 @@ Rails.configuration.to_prepare do | ||
27 | 27 | ||
28 | def create_activity | 28 | def create_activity |
29 | target = if self.target.is_a? Profile then self.target else self.target.profile rescue self.user end | 29 | target = if self.target.is_a? Profile then self.target else self.target.profile rescue self.user end |
30 | + return if !target | ||
30 | return if self.verb.in? target.exclude_verbs_on_activities | 31 | return if self.verb.in? target.exclude_verbs_on_activities |
31 | ProfileActivity.create! profile: target, activity: self | 32 | ProfileActivity.create! profile: target, activity: self |
32 | end | 33 | end |