mirror of
https://git.pleroma.social/pleroma/pleroma.git
synced 2024-11-15 21:51:09 +00:00
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 @@ defmodule Pleroma.Web.ActivityPub.MRF.ForceMentionsInContent do
|
||||||
|
|
||||||
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 a new issue