Fix admin delete in the UI
parent
1bfea16eed
commit
eba868e8e5
|
@ -740,7 +740,7 @@ async def admin_object(
|
|||
db_session: AsyncSession = Depends(get_db_session),
|
||||
) -> templates.TemplateResponse:
|
||||
requested_object = await boxes.get_anybox_object_by_ap_id(db_session, ap_id)
|
||||
if not requested_object:
|
||||
if not requested_object or requested_object.is_deleted:
|
||||
raise HTTPException(status_code=404)
|
||||
|
||||
replies_tree = await boxes.get_replies_tree(
|
||||
|
|
|
@ -99,7 +99,7 @@
|
|||
{% macro admin_delete_button(ap_object) %}
|
||||
<form action="{{ request.url_for("admin_actions_delete") }}" class="object-delete-form" method="POST">
|
||||
{{ embed_csrf_token() }}
|
||||
<input type="hidden" name="redirect_url" value="{% if request.url.path.endswith("/" + ap_object.public_id) %}{{ request.base_url}}{% else %}{{ request.url }}{% endif %}">
|
||||
<input type="hidden" name="redirect_url" value="{% if request.url.path.endswith("/" + ap_object.public_id) or (request.url.path == "/admin/object" and request.query_params.ap_id.endswith("/" + ap_object.public_id)) %}{{ request.base_url}}{% else %}{{ request.url }}{% endif %}">
|
||||
<input type="hidden" name="ap_object_id" value="{{ ap_object.ap_id }}">
|
||||
<input type="submit" value="delete">
|
||||
</form>
|
||||
|
|
Loading…
Reference in New Issue