Merge pull request #7011 from SuperTux88/fix-author-not-lowercase

Use Person.by_account_identifier to find the author
This commit is contained in:
Dennis Schubert 2016-08-21 14:26:20 +02:00
commit 003672f0b1
No known key found for this signature in database
GPG key ID: 5A0304BEA7966D7E
2 changed files with 12 additions and 1 deletions

View file

@ -180,7 +180,7 @@ module Diaspora
end end
private_class_method def self.author_of(entity) private_class_method def self.author_of(entity)
Person.find_by(diaspora_handle: entity.author) Person.by_account_identifier(entity.author)
end end
private_class_method def self.build_location(entity) private_class_method def self.build_location(entity)

View file

@ -585,6 +585,17 @@ describe Diaspora::Federation::Receive do
Diaspora::Federation::Receive.perform(status_message_entity) Diaspora::Federation::Receive.perform(status_message_entity)
end end
it "finds the correct author if the author is not lowercase" do
status_message_entity = FactoryGirl.build(:status_message_entity, author: sender.diaspora_handle.upcase)
received = Diaspora::Federation::Receive.perform(status_message_entity)
status_message = StatusMessage.find_by!(guid: status_message_entity.guid)
expect(received).to eq(status_message)
expect(status_message.author).to eq(sender)
end
end end
context "with poll" do context "with poll" do