ForceMentionsInContentTest: return mentions in a not terrible format
This commit is contained in:
parent
c5a20c80c4
commit
267184b70e
2 changed files with 29 additions and 15 deletions
|
|
@ -41,7 +41,7 @@ defmodule Pleroma.Web.ActivityPub.MRF.ForceMentionsInContent do
|
|||
|
||||
mention_users =
|
||||
to
|
||||
|> Enum.map(& {&1, User.get_cached_by_ap_id(&1)})
|
||||
|> Enum.map(&{&1, User.get_cached_by_ap_id(&1)})
|
||||
|> Enum.reject(fn {_, user} -> is_nil(user) end)
|
||||
|> Enum.into(%{})
|
||||
|
||||
|
|
@ -50,7 +50,7 @@ defmodule Pleroma.Web.ActivityPub.MRF.ForceMentionsInContent do
|
|||
added_mentions =
|
||||
Enum.reduce(mention_users, "", fn {uri, user}, acc ->
|
||||
unless uri in explicitly_mentioned_uris do
|
||||
acc <> Formatter.mention_from_user(user)
|
||||
acc <> Formatter.mention_from_user(user, %{mentions_format: :compact}) <> " "
|
||||
else
|
||||
acc
|
||||
end
|
||||
|
|
@ -58,7 +58,7 @@ defmodule Pleroma.Web.ActivityPub.MRF.ForceMentionsInContent do
|
|||
|
||||
content =
|
||||
if added_mentions != "",
|
||||
do: "<span class=\"recipients-inline\">#{added_mentions} </span>" <> content,
|
||||
do: "<span class=\"recipients-inline\">#{added_mentions}</span>" <> content,
|
||||
else: content
|
||||
|
||||
{:ok, put_in(object["object"]["content"], content)}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue