Delete activity before sending response to client
authorRoman Chvanikov <chvanikoff@pm.me>
Sun, 5 Jul 2020 21:01:25 +0000 (00:01 +0300)
committerRoman Chvanikov <chvanikoff@pm.me>
Sun, 5 Jul 2020 21:01:25 +0000 (00:01 +0300)
lib/pleroma/web/mastodon_api/controllers/status_controller.ex

index 3f4c53437829b5c4c7c48ce7aea8dbc6c381356a..12be530c999a94ff3b71ba4653dd4870dd93b489 100644 (file)
@@ -201,15 +201,13 @@ defmodule Pleroma.Web.MastodonAPI.StatusController do
   @doc "DELETE /api/v1/statuses/:id"
   def delete(%{assigns: %{user: user}} = conn, %{id: id}) do
     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
+      try_render(conn, "show.json",
+        activity: activity,
+        for: user,
+        with_direct_conversation_id: true,
+        with_source: true
+      )
     else
       _e -> {:error, :not_found}
     end