From 6f5d535b86d8e5a9462af1e634644162860f2748 Mon Sep 17 00:00:00 2001 From: Thomas Citharel Date: Thu, 15 Oct 2020 17:19:22 +0200 Subject: [PATCH] Fix finding local actor by username with domain Signed-off-by: Thomas Citharel --- lib/mobilizon/actors/actors.ex | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/mobilizon/actors/actors.ex b/lib/mobilizon/actors/actors.ex index d6ee2da7..11579fbd 100644 --- a/lib/mobilizon/actors/actors.ex +++ b/lib/mobilizon/actors/actors.ex @@ -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