ForceMentionsInContent: simplify finding users
This commit is contained in:
parent
d5644a52aa
commit
c5a20c80c4
|
@ -41,13 +41,8 @@ def filter(%{"type" => "Create", "object" => %{"type" => "Note", "to" => to}} =
|
||||||
|
|
||||||
mention_users =
|
mention_users =
|
||||||
to
|
to
|
||||||
|> Enum.map(fn ap_id_or_uri ->
|
|> Enum.map(& {&1, User.get_cached_by_ap_id(&1)})
|
||||||
case User.get_or_fetch_by_ap_id(ap_id_or_uri) do
|
|> Enum.reject(fn {_, user} -> is_nil(user) end)
|
||||||
{:ok, user} -> {ap_id_or_uri, user}
|
|
||||||
_ -> {ap_id_or_uri, User.get_by_uri(ap_id_or_uri)}
|
|
||||||
end
|
|
||||||
end)
|
|
||||||
|> Enum.reject(fn {_, user} -> user == nil end)
|
|
||||||
|> Enum.into(%{})
|
|> Enum.into(%{})
|
||||||
|
|
||||||
explicitly_mentioned_uris = extract_mention_uris_from_content(content)
|
explicitly_mentioned_uris = extract_mention_uris_from_content(content)
|
||||||
|
|
Loading…
Reference in New Issue