diff options
author | Haelwenn (lanodan) Monnier <contact@hacktivis.me> | 2020-06-26 07:16:24 +0200 |
---|---|---|
committer | Haelwenn (lanodan) Monnier <contact@hacktivis.me> | 2020-06-26 19:52:20 +0200 |
commit | 244655e884130df6dccabc0d2d78d33857809a36 (patch) | |
tree | 0e3d3d7310008259dae7db15130adc05e99030c2 /lib/pleroma/web/mastodon_api/controllers/status_controller.ex | |
parent | 27c33f216ad250b60d44fe0662c3be3c4cee987e (diff) |
MastoAPI: Show source field when deleting
Diffstat (limited to 'lib/pleroma/web/mastodon_api/controllers/status_controller.ex')
-rw-r--r-- | lib/pleroma/web/mastodon_api/controllers/status_controller.ex | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/lib/pleroma/web/mastodon_api/controllers/status_controller.ex b/lib/pleroma/web/mastodon_api/controllers/status_controller.ex index 468b44b67..3f4c53437 100644 --- a/lib/pleroma/web/mastodon_api/controllers/status_controller.ex +++ b/lib/pleroma/web/mastodon_api/controllers/status_controller.ex @@ -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 |