Commit 18df09eb8e2f9d3c5a278ebd1ec714d8733fa2f4
1 parent
c12aaa50
Exists in
master
and in
27 other branches
rails3: fix notify_activity_to_proiles_job tests
Showing
2 changed files
with
3 additions
and
0 deletions
Show diff stats
app/models/action_tracker_notification.rb
... | ... | @@ -8,6 +8,8 @@ class ActionTrackerNotification < ActiveRecord::Base |
8 | 8 | validates_presence_of :profile_id, :action_tracker_id |
9 | 9 | validates_uniqueness_of :action_tracker_id, :scope => :profile_id |
10 | 10 | |
11 | + attr_accessible :profile_id, :action_tracker_id | |
12 | + | |
11 | 13 | end |
12 | 14 | |
13 | 15 | ActionTracker::Record.has_many :action_tracker_notifications, :class_name => 'ActionTrackerNotification', :foreign_key => 'action_tracker_id', :dependent => :destroy | ... | ... |
lib/notify_activity_to_profiles_job.rb
... | ... | @@ -9,6 +9,7 @@ class NotifyActivityToProfilesJob < Struct.new(:tracked_action_id) |
9 | 9 | def perform |
10 | 10 | return unless ActionTracker::Record.exists?(tracked_action_id) |
11 | 11 | tracked_action = ActionTracker::Record.find(tracked_action_id) |
12 | + return unless tracked_action.user.present? | |
12 | 13 | target = tracked_action.target |
13 | 14 | if target.is_a?(Community) && NOTIFY_ONLY_COMMUNITY.include?(tracked_action.verb) |
14 | 15 | ActionTrackerNotification.create(:profile_id => target.id, :action_tracker_id => tracked_action.id) | ... | ... |