Merge pull request #7011 from SuperTux88/fix-author-not-lowercase
Use Person.by_account_identifier to find the author
This commit is contained in:
commit
003672f0b1
2 changed files with 12 additions and 1 deletions
|
|
@ -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)
|
||||||
|
|
|
||||||
|
|
@ -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
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue