Merge branch 'bugfix/status-deletion' into 'develop'

#1920 fix activity deletion

See merge request pleroma/pleroma!2721
This commit is contained in:
lain 2020-07-09 09:37:52 +00:00
commit 6d688f14fa
1 changed files with 6 additions and 8 deletions

View File

@ -201,15 +201,13 @@ def show(%{assigns: %{user: user}} = conn, %{id: id}) do
@doc "DELETE /api/v1/statuses/:id" @doc "DELETE /api/v1/statuses/:id"
def delete(%{assigns: %{user: user}} = conn, %{id: id}) do def delete(%{assigns: %{user: user}} = conn, %{id: id}) do
with %Activity{} = activity <- Activity.get_by_id_with_object(id), 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 {: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 else
_e -> {:error, :not_found} _e -> {:error, :not_found}
end end