Break out activity-specific HTML functions into Pleroma.Activity.HTML
Fixes cycles in lib/pleroma/ecto_type/activity_pub/object_validators/safe_text.ex
This commit is contained in:
parent
b221d77a6d
commit
3ff9c5e2a6
4 changed files with 49 additions and 38 deletions
|
|
@ -254,7 +254,7 @@ defmodule Pleroma.Web.MastodonAPI.StatusView do
|
|||
|
||||
content_html =
|
||||
content
|
||||
|> HTML.get_cached_scrubbed_html_for_activity(
|
||||
|> Activity.HTML.get_cached_scrubbed_html_for_activity(
|
||||
User.html_filter_policy(opts[:for]),
|
||||
activity,
|
||||
"mastoapi:content"
|
||||
|
|
@ -262,7 +262,7 @@ defmodule Pleroma.Web.MastodonAPI.StatusView do
|
|||
|
||||
content_plaintext =
|
||||
content
|
||||
|> HTML.get_cached_stripped_html_for_activity(
|
||||
|> Activity.HTML.get_cached_stripped_html_for_activity(
|
||||
activity,
|
||||
"mastoapi:content"
|
||||
)
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@
|
|||
# SPDX-License-Identifier: AGPL-3.0-only
|
||||
|
||||
defmodule Pleroma.Web.Metadata.Utils do
|
||||
alias Pleroma.Activity
|
||||
alias Pleroma.Emoji
|
||||
alias Pleroma.Formatter
|
||||
alias Pleroma.HTML
|
||||
|
|
@ -13,7 +14,7 @@ defmodule Pleroma.Web.Metadata.Utils do
|
|||
# html content comes from DB already encoded, decode first and scrub after
|
||||
|> HtmlEntities.decode()
|
||||
|> String.replace(~r/<br\s?\/?>/, " ")
|
||||
|> HTML.get_cached_stripped_html_for_activity(object, "metadata")
|
||||
|> Activity.HTML.get_cached_stripped_html_for_activity(object, "metadata")
|
||||
|> Emoji.Formatter.demojify()
|
||||
|> HtmlEntities.decode()
|
||||
|> Formatter.truncate()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue