diff --git a/app/models/action_tracker_notification.rb b/app/models/action_tracker_notification.rb index dda665c..c014641 100644 --- a/app/models/action_tracker_notification.rb +++ b/app/models/action_tracker_notification.rb @@ -8,6 +8,8 @@ class ActionTrackerNotification < ActiveRecord::Base validates_presence_of :profile_id, :action_tracker_id validates_uniqueness_of :action_tracker_id, :scope => :profile_id + attr_accessible :profile_id, :action_tracker_id + end ActionTracker::Record.has_many :action_tracker_notifications, :class_name => 'ActionTrackerNotification', :foreign_key => 'action_tracker_id', :dependent => :destroy diff --git a/lib/notify_activity_to_profiles_job.rb b/lib/notify_activity_to_profiles_job.rb index 4e2400c..7939238 100644 --- a/lib/notify_activity_to_profiles_job.rb +++ b/lib/notify_activity_to_profiles_job.rb @@ -9,6 +9,7 @@ class NotifyActivityToProfilesJob < Struct.new(:tracked_action_id) def perform return unless ActionTracker::Record.exists?(tracked_action_id) tracked_action = ActionTracker::Record.find(tracked_action_id) + return unless tracked_action.user.present? target = tracked_action.target if target.is_a?(Community) && NOTIFY_ONLY_COMMUNITY.include?(tracked_action.verb) ActionTrackerNotification.create(:profile_id => target.id, :action_tracker_id => tracked_action.id) -- libgit2 0.21.2