mastodon api: add interpreter for Article activity types
This commit is contained in:
parent
121c1f6230
commit
ea982e7503
|
@ -128,7 +128,7 @@ def render("status.json", %{activity: %{data: %{"object" => object}} = activity}
|
|||
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,
|
||||
|
@ -207,4 +207,20 @@ def get_visibility(object) do
|
|||
"direct"
|
||||
end
|
||||
end
|
||||
|
||||
def render_content(%{"type" => "Article"} = object) do
|
||||
summary = object["name"]
|
||||
content =
|
||||
if !!summary and summary != "" do
|
||||
"<p><a href=\"#{object["url"]}\">#{summary}</a></p>#{object["content"]}"
|
||||
else
|
||||
object["content"]
|
||||
end
|
||||
|
||||
HtmlSanitizeEx.basic_html(content)
|
||||
end
|
||||
|
||||
def render_content(object) do
|
||||
HtmlSanitizeEx.basic_html(object["content"])
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue