AccountController: Fix muting / unmuting reblogs.
[akkoma] / lib / pleroma / web / mastodon_api / controllers / status_controller.ex
index 468b44b6758ea43f89d67fb7603d6c19a1dabb2b..3f4c53437829b5c4c7c48ce7aea8dbc6c381356a 100644 (file)
@@ -200,11 +200,18 @@ defmodule Pleroma.Web.MastodonAPI.StatusController do
 
   @doc "DELETE /api/v1/statuses/:id"
   def delete(%{assigns: %{user: user}} = conn, %{id: id}) do
-    with {:ok, %Activity{}} <- CommonAPI.delete(id, user) do
-      json(conn, %{})
+    with %Activity{} = activity <- Activity.get_by_id_with_object(id),
+         render <-
+           try_render(conn, "show.json",
+             activity: activity,
+             for: user,
+             with_direct_conversation_id: true,
+             with_source: true
+           ),
+         {:ok, %Activity{}} <- CommonAPI.delete(id, user) do
+      render
     else
-      {:error, :not_found} = e -> e
-      _e -> render_error(conn, :forbidden, "Can't delete this post")
+      _e -> {:error, :not_found}
     end
   end