From: lambda Date: Thu, 12 Jul 2018 05:58:39 +0000 (+0000) Subject: Merge branch 'feature/article-support' into 'develop' X-Git-Url: https://git.squeep.com/?a=commitdiff_plain;h=4a922305afb9b445d11522be73428f10a7d1fc19;hp=-c;p=akkoma Merge branch 'feature/article-support' into 'develop' article support (plume, etc) See merge request pleroma/pleroma!240 --- 4a922305afb9b445d11522be73428f10a7d1fc19 diff --combined lib/pleroma/web/mastodon_api/views/status_view.ex index 39abb4c6b,6b48c41c1..4c20581d6 --- a/lib/pleroma/web/mastodon_api/views/status_view.ex +++ b/lib/pleroma/web/mastodon_api/views/status_view.ex @@@ -54,7 -54,8 +54,7 @@@ defmodule Pleroma.Web.MastodonAPI.Statu %{ id: to_string(activity.id), uri: object, - # TODO: This might be wrong, check with mastodon. - url: nil, + url: object, account: AccountView.render("account.json", %{user: user}), in_reply_to_id: nil, in_reply_to_account_id: nil, @@@ -127,7 -128,7 +127,7 @@@ in_reply_to_id: reply_to && to_string(reply_to.id), in_reply_to_account_id: reply_to_user && to_string(reply_to_user.id), reblog: nil, - content: HtmlSanitizeEx.basic_html(object["content"]), + content: render_content(object), created_at: created_at, reblogs_count: announcement_count, favourites_count: like_count, @@@ -206,4 -207,21 +206,21 @@@ "direct" end end + + def render_content(%{"type" => "Article"} = object) do + summary = object["name"] + + content = + if !!summary and summary != "" do + "

#{summary}

#{object["content"]}" + else + object["content"] + end + + HtmlSanitizeEx.basic_html(content) + end + + def render_content(object) do + HtmlSanitizeEx.basic_html(object["content"]) + end end