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()
|> 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()
|> HTML.strip_tags()
|> Formatter.truncate()
end
+
defp attachment_url(url) do
MediaProxy.url(url)
end
%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)