mirror of
https://codeberg.org/rimu/pyfedi
synced 2025-01-23 19:36:56 -08:00
Add/Remove activity for featured posts
This commit is contained in:
parent
136cb64a69
commit
e49cf220e9
1 changed files with 18 additions and 0 deletions
|
@ -666,6 +666,24 @@ def process_inbox_request(request_json, activitypublog_id, ip_address):
|
|||
target_ap_id = request_json['object']['object']['object'] # object object object!
|
||||
post = undo_vote(activity_log, comment, post, target_ap_id, user)
|
||||
activity_log.result = 'success'
|
||||
elif request_json['object']['type'] == 'Add':
|
||||
activity_log.activity_type = request_json['object']['type']
|
||||
featured_url = Community.query.filter(Community.ap_public_url == request_json['actor']).first().ap_featured_url
|
||||
if featured_url:
|
||||
if 'target' in request_json['object'] and featured_url == request_json['object']['target']:
|
||||
post = Post.query.filter(Post.ap_id == request_json['object']['object']).first()
|
||||
if post:
|
||||
post.sticky = True
|
||||
activity_log.result = 'success'
|
||||
elif request_json['object']['type'] == 'Remove':
|
||||
activity_log.activity_type = request_json['object']['type']
|
||||
featured_url = Community.query.filter(Community.ap_public_url == request_json['actor']).first().ap_featured_url
|
||||
if featured_url:
|
||||
if 'target' in request_json['object'] and featured_url == request_json['object']['target']:
|
||||
post = Post.query.filter(Post.ap_id == request_json['object']['object']).first()
|
||||
if post:
|
||||
post.sticky = False
|
||||
activity_log.result = 'success'
|
||||
else:
|
||||
activity_log.exception_message = 'Invalid type for Announce'
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue