diff --git a/app/models/post.rb b/app/models/post.rb index 0040843ee4a568600f6e9b0560083ee3723e02be..359e04aff4786b0a4db1133412b1df97b9154a3f 100644 --- a/app/models/post.rb +++ b/app/models/post.rb @@ -91,11 +91,14 @@ class Post < ActiveRecord::Base return local_post end elsif !local_post - self.save - user.contact_for(person).receive_post(self) - user.notify_if_mentioned(self) - Rails.logger.info("event=receive payload_type=#{self.class} update=false status=complete sender=#{self.diaspora_handle}") - return self + if self.save + user.contact_for(person).receive_post(self) + user.notify_if_mentioned(self) + Rails.logger.info("event=receive payload_type=#{self.class} update=false status=complete sender=#{self.diaspora_handle}") + return self + else + Rails.logger.info("event=receive payload_type=#{self.class} update=false status=abort sender=#{self.diaspora_handle} reason=#{self.errors.full_messages}") + end else Rails.logger.info("event=receive payload_type=#{self.class} update=true status=abort sender=#{self.diaspora_handle} reason='update not from post owner' existing_post=#{self.id}") end