mirror of
https://codeberg.org/rimu/pyfedi
synced 2025-01-23 19:36:56 -08:00
post-reply soft-deletion: remote users in local communities
This commit is contained in:
parent
0220739d16
commit
1a0ad888db
1 changed files with 14 additions and 11 deletions
|
@ -1107,18 +1107,21 @@ def process_inbox_request(request_json, activitypublog_id, ip_address):
|
||||||
# Delete PostReply
|
# Delete PostReply
|
||||||
reply = PostReply.query.filter_by(ap_id=ap_id).first()
|
reply = PostReply.query.filter_by(ap_id=ap_id).first()
|
||||||
if reply:
|
if reply:
|
||||||
if can_delete(request_json['actor'], reply):
|
deletor = find_actor_or_create(request_json['actor'], create_if_not_found=False)
|
||||||
reply.body_html = '<p><em>deleted</em></p>'
|
if deletor:
|
||||||
reply.body = 'deleted'
|
if reply.author.id == deletor.id or reply.community.is_moderator(deletor) or reply.community.is_instance_admin(deletor):
|
||||||
if not reply.author.bot:
|
reply.deleted = True
|
||||||
reply.post.reply_count -= 1
|
reply.deleted_by = deletor.id
|
||||||
reply.deleted = True
|
if not reply.author.bot:
|
||||||
announce_activity_to_followers(reply.community, reply.author, request_json)
|
reply.post.reply_count -= 1
|
||||||
reply.author.post_reply_count -= 1
|
reply.author.post_reply_count -= 1
|
||||||
db.session.commit()
|
announce_activity_to_followers(reply.community, reply.author, request_json)
|
||||||
activity_log.result = 'success'
|
db.session.commit()
|
||||||
|
activity_log.result = 'success'
|
||||||
|
else:
|
||||||
|
activity_log.exception_message = 'Delete attempt denied'
|
||||||
else:
|
else:
|
||||||
activity_log.exception_message = 'Delete attempt denied'
|
activity_log.exception_message = 'Deletor did not already exist'
|
||||||
else:
|
else:
|
||||||
# Delete User
|
# Delete User
|
||||||
user = find_actor_or_create(ap_id, create_if_not_found=False)
|
user = find_actor_or_create(ap_id, create_if_not_found=False)
|
||||||
|
|
Loading…
Add table
Reference in a new issue