mirror of
https://codeberg.org/rimu/pyfedi
synced 2025-02-03 00:31:25 -08:00
apf part 25: Announce / Lock
This commit is contained in:
parent
c4665ace21
commit
c226a6806a
1 changed files with 16 additions and 0 deletions
|
@ -947,6 +947,22 @@ def process_inbox_request(request_json, store_ap_json):
|
||||||
log_incoming_ap(request_json['id'], APLOG_REPORT, APLOG_IGNORED, request_json if store_ap_json else None, 'Report ignored due to missing content')
|
log_incoming_ap(request_json['id'], APLOG_REPORT, APLOG_IGNORED, request_json if store_ap_json else None, 'Report ignored due to missing content')
|
||||||
return
|
return
|
||||||
|
|
||||||
|
if request_json['object']['type'] == 'Lock': # Announce of post lock
|
||||||
|
mod = user
|
||||||
|
post_id = request_json['object']['object']
|
||||||
|
post = Post.query.filter_by(ap_id=post_id).first()
|
||||||
|
if post:
|
||||||
|
if post.community.is_moderator(mod) or post.community.is_instance_admin(mod):
|
||||||
|
post.comments_enabled = False
|
||||||
|
db.session.commit()
|
||||||
|
log_incoming_ap(request_json['id'], APLOG_LOCK, APLOG_SUCCESS, request_json if store_ap_json else None)
|
||||||
|
else:
|
||||||
|
log_incoming_ap(request_json['id'], APLOG_LOCK, APLOG_FAILURE, request_json if store_ap_json else None, 'Lock: Does not have permission')
|
||||||
|
else:
|
||||||
|
log_incoming_ap(request_json['id'], APLOG_LOCK, APLOG_FAILURE, request_json if store_ap_json else None, 'Lock: post not found')
|
||||||
|
return
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# -- below this point is code that will be incrementally replaced to use log_incoming_ap() instead --
|
# -- below this point is code that will be incrementally replaced to use log_incoming_ap() instead --
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue