diff --git a/lib/postzord/receiver.rb b/lib/postzord/receiver.rb index e561e9bca..55b49fb2b 100644 --- a/lib/postzord/receiver.rb +++ b/lib/postzord/receiver.rb @@ -20,7 +20,7 @@ module Postzord def perform if @sender && self.salmon.verified_for_key?(@sender.public_key) - parse_and_receive(salmon.parsed_data) + parse_and_receive(salmon.parsed_data) else Rails.logger.info("event=receive status=abort recipient=#{@user.diaspora_handle} sender=#{@salmon.author_email} reason='not_verified for key'") nil @@ -70,7 +70,7 @@ module Postzord @object.sender_handle = @sender.diaspora_handle end - + if (@author.diaspora_handle != xml_author) Rails.logger.info("event=receive status=abort reason='author in xml does not match retrieved person' payload_type=#{@object.class} recipient=#{@user_person.diaspora_handle} sender=#{@sender.diaspora_handle}") return false diff --git a/spec/models/photo_spec.rb b/spec/models/photo_spec.rb index eeec0d303..c628514ae 100644 --- a/spec/models/photo_spec.rb +++ b/spec/models/photo_spec.rb @@ -130,10 +130,10 @@ describe Photo do thumb_url = @photo.url :thumb_medium xml = @photo.to_diaspora_xml - id = @photo.id @photo.destroy - @photo.receive(user2, @user.person) + zord = Postzord::Receiver.new(user2, :person => @photo.person) + zord.parse_and_receive(xml) new_photo = Photo.where(:guid => @photo.guid).first new_photo.url.nil?.should be false