fix spelling and update job to use less obtrusive query
This commit is contained in:
parent
c3dc3d103b
commit
b7d0ec7564
3 changed files with 15 additions and 10 deletions
|
|
@ -9,18 +9,12 @@ module Jobs
|
|||
require File.join(Rails.root, 'app/models/notification')
|
||||
|
||||
def self.perform(user_ids, object_klass, object_id, person_id)
|
||||
|
||||
object = object_klass.constantize.find_by_id(object_id)
|
||||
|
||||
#hax
|
||||
return if (object.author.diaspora_handle == 'diasporahq@joindiaspora.com' || (object.respond_to?(:relayable?) && object.parent.author.diaspora_handle == 'diasporahq@joindiaspora.com'))
|
||||
#end hax
|
||||
|
||||
#this is really terrible
|
||||
users = User.where(:id => user_ids)
|
||||
users = object.participant_users
|
||||
person = Person.find_by_id(person_id)
|
||||
|
||||
users.each{|user| Notification.notify(user, object, person) }
|
||||
users.each do |user|
|
||||
Notification.notify(user, object, person)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -50,6 +50,10 @@ module Diaspora
|
|||
self.parent.participants
|
||||
end
|
||||
|
||||
def participant_users
|
||||
self.parent.participant_users
|
||||
end
|
||||
|
||||
def receive(user, person=nil)
|
||||
comment_or_like = self.class.where(:guid => self.guid).first || self
|
||||
|
||||
|
|
|
|||
|
|
@ -123,6 +123,13 @@ module Diaspora
|
|||
end.call
|
||||
end
|
||||
|
||||
def participant_users
|
||||
@participant_users ||= lambda do
|
||||
user_ids = participants.map{|x| x.owner_id}.compact
|
||||
User.where(:id => user_ids)
|
||||
end.call
|
||||
end
|
||||
|
||||
protected
|
||||
|
||||
# @return [Shareable,void]
|
||||
|
|
|
|||
Loading…
Reference in a new issue