Fix finding local actor by username with domain

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
Thomas Citharel 2020-10-15 17:19:22 +02:00
parent 479bd466b5
commit 6f5d535b86
No known key found for this signature in database
GPG Key ID: A061B9DDE0CA0773
1 changed files with 6 additions and 0 deletions

View File

@ -1616,6 +1616,12 @@ defmodule Mobilizon.Actors do
from(a in query, where: a.preferred_username == ^name and is_nil(a.domain))
end
@own_domain Mobilizon.Config.instance_hostname()
defp filter_by_name(query, [name, @own_domain]) do
filter_by_name(query, [name])
end
defp filter_by_name(query, [name, domain]) do
from(a in query, where: a.preferred_username == ^name and a.domain == ^domain)
end