Delete activity before sending response to client
This commit is contained in:
parent
c2a052a346
commit
fc1f34b851
|
@ -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 <-
|
{:ok, %Activity{}} <- CommonAPI.delete(id, user) do
|
||||||
try_render(conn, "show.json",
|
try_render(conn, "show.json",
|
||||||
activity: activity,
|
activity: activity,
|
||||||
for: user,
|
for: user,
|
||||||
with_direct_conversation_id: true,
|
with_direct_conversation_id: true,
|
||||||
with_source: true
|
with_source: true
|
||||||
),
|
)
|
||||||
{:ok, %Activity{}} <- CommonAPI.delete(id, user) do
|
|
||||||
render
|
|
||||||
else
|
else
|
||||||
_e -> {:error, :not_found}
|
_e -> {:error, :not_found}
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue