mirror of
https://codeberg.org/rimu/pyfedi
synced 2025-02-03 00:31:25 -08:00
post-reply soft-deletion: add info to activitypublog for deletions
This commit is contained in:
parent
0495d8a30e
commit
0220739d16
1 changed files with 12 additions and 1 deletions
|
@ -1314,8 +1314,9 @@ def delete_post_or_comment_task(user_ap_id, community_ap_id, to_be_deleted_ap_id
|
||||||
deletor = find_actor_or_create(user_ap_id)
|
deletor = find_actor_or_create(user_ap_id)
|
||||||
community = find_actor_or_create(community_ap_id, community_only=True)
|
community = find_actor_or_create(community_ap_id, community_only=True)
|
||||||
to_delete = find_liked_object(to_be_deleted_ap_id)
|
to_delete = find_liked_object(to_be_deleted_ap_id)
|
||||||
|
aplog = ActivityPubLog.query.get(aplog_id)
|
||||||
|
|
||||||
if to_delete and to_delete.deleted:
|
if to_delete and to_delete.deleted:
|
||||||
aplog = ActivityPubLog.query.get(aplog_id)
|
|
||||||
if aplog:
|
if aplog:
|
||||||
aplog.result = 'ignored'
|
aplog.result = 'ignored'
|
||||||
aplog.exception_message = 'Activity about local content which is already deleted'
|
aplog.exception_message = 'Activity about local content which is already deleted'
|
||||||
|
@ -1345,6 +1346,16 @@ def delete_post_or_comment_task(user_ap_id, community_ap_id, to_be_deleted_ap_id
|
||||||
add_to_modlog_activitypub('delete_post_reply', deletor, community_id=community.id,
|
add_to_modlog_activitypub('delete_post_reply', deletor, community_id=community.id,
|
||||||
link_text=f'comment on {shorten_string(to_delete.post.title)}',
|
link_text=f'comment on {shorten_string(to_delete.post.title)}',
|
||||||
link=f'post/{to_delete.post.id}#comment_{to_delete.id}')
|
link=f'post/{to_delete.post.id}#comment_{to_delete.id}')
|
||||||
|
if aplog:
|
||||||
|
aplog.result = 'success'
|
||||||
|
else:
|
||||||
|
if aplog:
|
||||||
|
aplog.result = 'failure'
|
||||||
|
aplog.exception_message = 'Deletor did not have permission'
|
||||||
|
else:
|
||||||
|
if aplog:
|
||||||
|
aplog.result = 'failure'
|
||||||
|
aplog.exception_message = 'Unable to resolve deletor, community, or target'
|
||||||
|
|
||||||
|
|
||||||
def restore_post_or_comment(object_json):
|
def restore_post_or_comment(object_json):
|
||||||
|
|
Loading…
Add table
Reference in a new issue