mirror of
https://codeberg.org/rimu/pyfedi
synced 2025-01-24 11:51:27 -08:00
whack a mole
This commit is contained in:
parent
87b4476fda
commit
a3af8de34b
1 changed files with 37 additions and 2 deletions
|
@ -509,14 +509,49 @@ def process_inbox_request(request_json, activitypublog_id, ip_address):
|
||||||
elif request_json['object']['type'] == 'Page': # Editing a post
|
elif request_json['object']['type'] == 'Page': # Editing a post
|
||||||
post = Post.query.filter_by(ap_id=request_json['object']['id']).first()
|
post = Post.query.filter_by(ap_id=request_json['object']['id']).first()
|
||||||
if post:
|
if post:
|
||||||
|
try:
|
||||||
update_post_from_activity(post, request_json['object'])
|
update_post_from_activity(post, request_json['object'])
|
||||||
|
except KeyError:
|
||||||
|
activity_log.result = 'exception'
|
||||||
|
db.session.commit()
|
||||||
|
return
|
||||||
activity_log.result = 'success'
|
activity_log.result = 'success'
|
||||||
else:
|
else:
|
||||||
activity_log.exception_message = 'Post not found'
|
activity_log.exception_message = 'Post not found'
|
||||||
elif request_json['object']['type'] == 'Note': # Editing a reply
|
elif request_json['object']['type'] == 'Note': # Editing a reply
|
||||||
reply = PostReply.query.filter_by(ap_id=request_json['object']['id']).first()
|
reply = PostReply.query.filter_by(ap_id=request_json['object']['id']).first()
|
||||||
if reply:
|
if reply:
|
||||||
update_post_reply_from_activity(reply, request_json)
|
try:
|
||||||
|
update_post_reply_from_activity(reply, request_json['object'])
|
||||||
|
except KeyError:
|
||||||
|
activity_log.result = 'exception'
|
||||||
|
db.session.commit()
|
||||||
|
return
|
||||||
|
activity_log.result = 'success'
|
||||||
|
else:
|
||||||
|
activity_log.exception_message = 'PostReply not found'
|
||||||
|
elif request_json['object']['type'] == 'Update':
|
||||||
|
if request_json['object']['object']['type'] == 'Page':
|
||||||
|
post = Post.query.filter_by(ap_id=request_json['object']['object']['id']).first()
|
||||||
|
if post:
|
||||||
|
try:
|
||||||
|
update_post_from_activity(post, request_json['object'])
|
||||||
|
except KeyError:
|
||||||
|
activity_log.result = 'exception'
|
||||||
|
db.session.commit()
|
||||||
|
return
|
||||||
|
activity_log.result = 'success'
|
||||||
|
else:
|
||||||
|
activity_log.exception_message = 'Post not found'
|
||||||
|
elif request_json['object']['object']['type'] == 'Note':
|
||||||
|
reply = PostReply.query.filter_by(ap_id=request_json['object']['object']['id']).first()
|
||||||
|
if reply:
|
||||||
|
try:
|
||||||
|
update_post_reply_from_activity(reply, request_json['object'])
|
||||||
|
except KeyError:
|
||||||
|
activity_log.result = 'exception'
|
||||||
|
db.session.commit()
|
||||||
|
return
|
||||||
activity_log.result = 'success'
|
activity_log.result = 'success'
|
||||||
else:
|
else:
|
||||||
activity_log.exception_message = 'PostReply not found'
|
activity_log.exception_message = 'PostReply not found'
|
||||||
|
|
Loading…
Add table
Reference in a new issue