Use Person.by_account_identifier to find the author

This commit is contained in:
Benjamin Neff 2016-08-21 04:01:42 +02:00
parent 08c6d485e4
commit 1d5080888f
2 changed files with 12 additions and 1 deletions

View file

@ -180,7 +180,7 @@ module Diaspora
end
private_class_method def self.author_of(entity)
Person.find_by(diaspora_handle: entity.author)
Person.by_account_identifier(entity.author)
end
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)
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
context "with poll" do