Commit dd1432d6 authored by rinpatch's avatar rinpatch
Browse files

Disable previews for any activity, but create

parent 565caff3
......@@ -71,7 +71,7 @@ defp build_attachments(activity) do
end)
end
defp scrub_html_and_truncate(%{data: %{ "object" => %{ "content" => content}}} = activity) do
defp scrub_html_and_truncate(%{data: %{"object" => %{"content" => content}}} = activity) do
content
# html content comes from DB already encoded, decode first and scrub after
|> HtmlEntities.decode()
......@@ -80,7 +80,7 @@ defp scrub_html_and_truncate(%{data: %{ "object" => %{ "content" => content}}} =
|> Formatter.truncate()
end
defp scrub_html_and_truncate(content) do
defp scrub_html_and_truncate(content) when is_binary(content) do
content
# html content comes from DB already encoded, decode first and scrub after
|> HtmlEntities.decode()
......@@ -88,6 +88,7 @@ defp scrub_html_and_truncate(content) do
|> HTML.strip_tags()
|> Formatter.truncate()
end
defp attachment_url(url) do
MediaProxy.url(url)
end
......
......@@ -145,7 +145,15 @@ def notice(conn, %{"id" => id}) do
%User{} = user <- User.get_cached_by_ap_id(activity.data["actor"]) do
case format = get_format(conn) do
"html" ->
Fallback.RedirectController.redirector_with_meta(conn, %{activity: activity, user: user})
# Only Create actvities have a map at object
if is_map(activity.data["object"]) do
Fallback.RedirectController.redirector_with_meta(conn, %{
activity: activity,
user: user
})
else
Fallback.RedirectController.redirector(conn, nil)
end
_ ->
represent_activity(conn, format, activity, user)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment