mirror of
https://git.sr.ht/~tsileo/microblog.pub
synced 2024-12-22 13:14:28 +00:00
Improve inbox delete side effects
This commit is contained in:
parent
715df3c563
commit
25d3daa6d2
1 changed files with 11 additions and 1 deletions
12
app/boxes.py
12
app/boxes.py
|
@ -1069,7 +1069,17 @@ async def _revert_side_effect_for_deleted_object(
|
||||||
) -> None:
|
) -> None:
|
||||||
is_delete_needs_to_be_forwarded = False
|
is_delete_needs_to_be_forwarded = False
|
||||||
|
|
||||||
# Decrement the replies counter if needed
|
# Delete related notifications
|
||||||
|
notif_deletion_result = await db_session.execute(
|
||||||
|
delete(models.Notification)
|
||||||
|
.where(models.Notification.inbox_object_id == deleted_ap_object.id)
|
||||||
|
.execution_options(synchronize_session=False)
|
||||||
|
)
|
||||||
|
logger.info(
|
||||||
|
f"Deleted {notif_deletion_result.rowcount} notifications" # type: ignore
|
||||||
|
)
|
||||||
|
|
||||||
|
# Decrement/refresh the replies counter if needed
|
||||||
if deleted_ap_object.in_reply_to:
|
if deleted_ap_object.in_reply_to:
|
||||||
replied_object = await get_anybox_object_by_ap_id(
|
replied_object = await get_anybox_object_by_ap_id(
|
||||||
db_session,
|
db_session,
|
||||||
|
|
Loading…
Reference in a new issue