refactor, status view updating, error handling

This commit is contained in:
Karen Konou 2019-02-10 09:31:20 +01:00
commit cc21fc5f53
3 changed files with 26 additions and 19 deletions

View file

@ -450,6 +450,11 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIController do
conn
|> put_view(StatusView)
|> try_render("status.json", %{activity: activity, for: user, as: :activity})
else
{:error, reason} ->
conn
|> put_resp_content_type("application/json")
|> send_resp(:bad_request, Jason.encode!(%{"error" => reason}))
end
end

View file

@ -160,7 +160,7 @@ defmodule Pleroma.Web.MastodonAPI.StatusView do
reblogged: present?(repeated),
favourited: present?(favorited),
bookmarked: present?(bookmarked),
muted: false,
muted: Pleroma.Web.ThreadMute.muted?(user, activity),
pinned: pinned?(activity, user),
sensitive: sensitive,
spoiler_text: object["summary"] || "",