1
0
Fork 0
mirror of https://git.pleroma.social/pleroma/pleroma.git synced 2026-02-15 17:16:57 +00:00

Fix and format.

This commit is contained in:
lain 2019-04-05 22:24:58 +02:00
parent d79a59c3b8
commit ef4e67d767
2 changed files with 19 additions and 5 deletions

View file

@ -138,7 +138,15 @@ defmodule Pleroma.Web.MastodonAPI.StatusView do
|> HTML.get_cached_scrubbed_html_for_object(
User.html_filter_policy(opts[:for]),
activity,
__MODULE__
"mastoapi:content"
)
summary =
(object["summary"] || "")
|> HTML.get_cached_scrubbed_html_for_object(
User.html_filter_policy(opts[:for]),
activity,
"mastoapi:summary"
)
card = render("card.json", Pleroma.Web.RichMedia.Helpers.fetch_data_for_activity(activity))
@ -163,7 +171,7 @@ defmodule Pleroma.Web.MastodonAPI.StatusView do
muted: false,
pinned: pinned?(activity, user),
sensitive: sensitive,
spoiler_text: object["summary"] || "",
spoiler_text: summary,
visibility: get_visibility(object),
media_attachments: attachments |> Enum.take(4),
mentions: mentions,

View file

@ -69,7 +69,12 @@ defmodule Pleroma.Web.MastodonAPI.StatusViewTest do
test "a note activity" do
user = insert(:user)
{:ok, note} = CommonAPI.post(user, %{"status" => "cool test :firefox: #yeah", "spoiler_text" => "<script>alert('alerta')</script>test"})
{:ok, note} =
CommonAPI.post(user, %{
"status" => "cool test :firefox: #yeah",
"spoiler_text" => "<script>alert('alerta')</script>test"
})
status = StatusView.render("status.json", %{activity: note})
@ -88,7 +93,8 @@ defmodule Pleroma.Web.MastodonAPI.StatusViewTest do
in_reply_to_account_id: nil,
card: nil,
reblog: nil,
content: "cool test :firefox: <a class=\"hashtag\" data-tag=\"yeah\" href=\"http://localhost:4001/tag/yeah\">#yeah</a>",
content:
"cool test :firefox: <a class=\"hashtag\" data-tag=\"yeah\" href=\"http://localhost:4001/tag/yeah\">#yeah</a>",
created_at: created_at,
reblogs_count: 0,
replies_count: 0,
@ -99,7 +105,7 @@ defmodule Pleroma.Web.MastodonAPI.StatusViewTest do
muted: false,
pinned: false,
sensitive: false,
spoiler_text: "test",
spoiler_text: "alert('alerta')test",
visibility: "public",
media_attachments: [],
mentions: [AccountView.render("mention.json", %{user: user})],