mirror of
https://codeberg.org/rimu/pyfedi
synced 2025-02-02 16:21:32 -08:00
Ignore Announces intended for Mastodon
This commit is contained in:
parent
01a235725e
commit
96528ada90
1 changed files with 10 additions and 24 deletions
|
@ -672,30 +672,16 @@ def process_inbox_request(request_json, activitypublog_id, ip_address):
|
|||
ocp.cross_posts.remove(post.id)
|
||||
delete_post_or_comment(user_ap_id, community_ap_id, to_be_deleted_ap_id)
|
||||
activity_log.result = 'success'
|
||||
elif request_json['object']['type'] == 'Page': # Editing a post
|
||||
post = Post.query.filter_by(ap_id=request_json['object']['id']).first()
|
||||
if post:
|
||||
try:
|
||||
update_post_from_activity(post, request_json)
|
||||
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']['type'] == 'Note': # Editing a reply
|
||||
reply = PostReply.query.filter_by(ap_id=request_json['object']['id']).first()
|
||||
if reply:
|
||||
try:
|
||||
update_post_reply_from_activity(reply, request_json)
|
||||
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'] == 'Page': # Sent for Mastodon's benefit
|
||||
activity_log.result = 'ignored'
|
||||
activity_log.exception_message = 'Intended for Mastodon'
|
||||
db.session.add(activity_log)
|
||||
db.session.commit()
|
||||
elif request_json['object']['type'] == 'Note': # Never sent?
|
||||
activity_log.result = 'ignored'
|
||||
activity_log.exception_message = 'Intended for Mastodon'
|
||||
db.session.add(activity_log)
|
||||
db.session.commit()
|
||||
elif request_json['object']['type'] == 'Update': # Editing a post or comment
|
||||
if request_json['object']['object']['type'] == 'Page':
|
||||
post = Post.query.filter_by(ap_id=request_json['object']['object']['id']).first()
|
||||
|
|
Loading…
Add table
Reference in a new issue