Skip to content
Extraits de code Groupes Projets
Valider 1343188c rédigé par Maxwell Salzberg's avatar Maxwell Salzberg
Parcourir les fichiers

dont do the comments in a transaction, we build other jobs

parent 6c414d85
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
......@@ -46,33 +46,30 @@ module Diaspora
end
def receive(user, person=nil)
comment_or_like = self.class.where(:guid => self.guid).first || self
self.class.transaction do
comment_or_like = self.class.where(:guid => self.guid).first || self
#check to make sure the signature of the comment or like comes from the person claiming to authoring said comment or like
unless comment_or_like.parent.author == user.person || comment_or_like.verify_parent_author_signature
Rails.logger.info("event=receive status=abort reason='object signature not valid' recipient=#{user.diaspora_handle} sender=#{self.parent.author.diaspora_handle} payload_type=#{self.class} parent_id=#{self.parent.id}")
return
end
#check to make sure the signature of the comment or like comes from the person claiming to authoring said comment or like
unless comment_or_like.parent.author == user.person || comment_or_like.verify_parent_author_signature
Rails.logger.info("event=receive status=abort reason='object signature not valid' recipient=#{user.diaspora_handle} sender=#{self.parent.author.diaspora_handle} payload_type=#{self.class} parent_id=#{self.parent.id}")
return
end
#as the owner of the post being liked or commented on, you need to add your own signature in order to pass it to the people who received your original post
if user.owns? comment_or_like.parent
comment_or_like.parent_author_signature = comment_or_like.sign_with_key(user.encryption_key)
comment_or_like.save!
end
#as the owner of the post being liked or commented on, you need to add your own signature in order to pass it to the people who received your original post
if user.owns? comment_or_like.parent
comment_or_like.parent_author_signature = comment_or_like.sign_with_key(user.encryption_key)
comment_or_like.save!
end
#dispatch object DOWNSTREAM, received it via UPSTREAM
unless user.owns?(comment_or_like)
comment_or_like.save!
Postzord::Dispatcher.build(user, comment_or_like).post
end
#dispatch object DOWNSTREAM, received it via UPSTREAM
unless user.owns?(comment_or_like)
comment_or_like.save!
Postzord::Dispatcher.build(user, comment_or_like).post
end
comment_or_like.socket_to_user(user) if comment_or_like.respond_to? :socket_to_user
comment_or_like.socket_to_user(user) if comment_or_like.respond_to? :socket_to_user
if comment_or_like.after_receive(user, person)
comment_or_like
end
if comment_or_like.after_receive(user, person)
comment_or_like
end
end
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter