mirror of
https://git.sr.ht/~tsileo/microblog.pub
synced 2024-12-22 13:14:28 +00:00
Fix admin delete in the UI
This commit is contained in:
parent
1bfea16eed
commit
eba868e8e5
2 changed files with 2 additions and 2 deletions
|
@ -740,7 +740,7 @@ async def admin_object(
|
||||||
db_session: AsyncSession = Depends(get_db_session),
|
db_session: AsyncSession = Depends(get_db_session),
|
||||||
) -> templates.TemplateResponse:
|
) -> templates.TemplateResponse:
|
||||||
requested_object = await boxes.get_anybox_object_by_ap_id(db_session, ap_id)
|
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)
|
raise HTTPException(status_code=404)
|
||||||
|
|
||||||
replies_tree = await boxes.get_replies_tree(
|
replies_tree = await boxes.get_replies_tree(
|
||||||
|
|
|
@ -99,7 +99,7 @@
|
||||||
{% macro admin_delete_button(ap_object) %}
|
{% macro admin_delete_button(ap_object) %}
|
||||||
<form action="{{ request.url_for("admin_actions_delete") }}" class="object-delete-form" method="POST">
|
<form action="{{ request.url_for("admin_actions_delete") }}" class="object-delete-form" method="POST">
|
||||||
{{ embed_csrf_token() }}
|
{{ 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="hidden" name="ap_object_id" value="{{ ap_object.ap_id }}">
|
||||||
<input type="submit" value="delete">
|
<input type="submit" value="delete">
|
||||||
</form>
|
</form>
|
||||||
|
|
Loading…
Reference in a new issue