ForceMentionsInContent: simplify finding users
This commit is contained in:
parent
d5644a52aa
commit
c5a20c80c4
1 changed files with 2 additions and 7 deletions
|
@ -41,13 +41,8 @@ def filter(%{"type" => "Create", "object" => %{"type" => "Note", "to" => to}} =
|
|||
|
||||
mention_users =
|
||||
to
|
||||
|> Enum.map(fn ap_id_or_uri ->
|
||||
case User.get_or_fetch_by_ap_id(ap_id_or_uri) do
|
||||
{: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.map(& {&1, User.get_cached_by_ap_id(&1)})
|
||||
|> Enum.reject(fn {_, user} -> is_nil(user) end)
|
||||
|> Enum.into(%{})
|
||||
|
||||
explicitly_mentioned_uris = extract_mention_uris_from_content(content)
|
||||
|
|
Loading…
Reference in a new issue