strip_html/1 is only called for titles of RSS feeds now, so move it
This commit is contained in:
parent
2ad52086b8
commit
65137044c1
@ -7,6 +7,7 @@ defmodule Pleroma.Web.Feed.FeedView do
|
||||
use Pleroma.Web, :view
|
||||
|
||||
alias Pleroma.Formatter
|
||||
alias Pleroma.HTML
|
||||
alias Pleroma.Object
|
||||
alias Pleroma.User
|
||||
alias Pleroma.Web.MediaProxy
|
||||
@ -70,7 +71,9 @@ defmodule Pleroma.Web.Feed.FeedView do
|
||||
|
||||
def activity_title(%{"content" => content}, opts \\ %{}) do
|
||||
content
|
||||
|> Pleroma.Web.Metadata.Utils.scrub_html()
|
||||
|> HtmlEntities.decode()
|
||||
|> String.replace(~r/<br\s?\/?>/, " ")
|
||||
|> HTML.strip_tags()
|
||||
|> Pleroma.Emoji.Formatter.demojify()
|
||||
|> Formatter.truncate(opts[:max_length], opts[:omission])
|
||||
|> escape()
|
||||
|
@ -6,7 +6,6 @@ defmodule Pleroma.Web.Metadata.Utils do
|
||||
alias Pleroma.Activity
|
||||
alias Pleroma.Emoji
|
||||
alias Pleroma.Formatter
|
||||
alias Pleroma.HTML
|
||||
|
||||
def scrub_html_and_truncate(%{data: %{"content" => content}} = object) do
|
||||
content
|
||||
@ -21,22 +20,12 @@ defmodule Pleroma.Web.Metadata.Utils do
|
||||
|
||||
def scrub_html_and_truncate(content, max_length \\ 200) when is_binary(content) do
|
||||
content
|
||||
|> scrub_html
|
||||
|> Emoji.Formatter.demojify()
|
||||
|> HtmlEntities.decode()
|
||||
|> String.replace(~r/<br\s?\/?>/, " ")
|
||||
|> Formatter.truncate(max_length)
|
||||
end
|
||||
|
||||
def scrub_html(content) when is_binary(content) do
|
||||
content
|
||||
# html content comes from DB already encoded, decode first and scrub after
|
||||
|> HtmlEntities.decode()
|
||||
|> String.replace(~r/<br\s?\/?>/, " ")
|
||||
|> HTML.strip_tags()
|
||||
end
|
||||
|
||||
def scrub_html(content), do: content
|
||||
|
||||
def user_name_string(user) do
|
||||
"#{user.name} " <>
|
||||
if user.local do
|
||||
|
Loading…
Reference in New Issue
Block a user