ignore unfound objects when voting

This commit is contained in:
rimu 2024-01-04 16:56:37 +13:00
parent 7d2b6b8f6a
commit 80ad21deeb

View file

@ -431,6 +431,8 @@ def process_inbox_request(request_json, activitypublog_id, ip_address):
if user is None: if user is None:
activity_log.exception_message = 'Blocked or unfound user' activity_log.exception_message = 'Blocked or unfound user'
elif liked is None:
activity_log.exception_message = 'Unfound object'
elif user.is_local(): elif user.is_local():
activity_log.exception_message = 'Activity about local content which is already present' activity_log.exception_message = 'Activity about local content which is already present'
activity_log.result = 'ignored' activity_log.result = 'ignored'
@ -465,6 +467,8 @@ def process_inbox_request(request_json, activitypublog_id, ip_address):
disliked = find_liked_object(liked_ap_id) disliked = find_liked_object(liked_ap_id)
if user is None: if user is None:
activity_log.exception_message = 'Blocked or unfound user' activity_log.exception_message = 'Blocked or unfound user'
elif disliked is None:
activity_log.exception_message = 'Unfound object'
elif user.is_local(): elif user.is_local():
activity_log.exception_message = 'Activity about local content which is already present' activity_log.exception_message = 'Activity about local content which is already present'
activity_log.result = 'ignored' activity_log.result = 'ignored'
@ -641,6 +645,8 @@ def process_inbox_request(request_json, activitypublog_id, ip_address):
liked = find_liked_object(request_json['object']) liked = find_liked_object(request_json['object'])
if user is None: if user is None:
activity_log.exception_message = 'Blocked or unfound user' activity_log.exception_message = 'Blocked or unfound user'
elif liked is None:
activity_log.exception_message = 'Unfound object'
elif user.is_local(): elif user.is_local():
activity_log.exception_message = 'Activity about local content which is already present' activity_log.exception_message = 'Activity about local content which is already present'
activity_log.result = 'ignored' activity_log.result = 'ignored'
@ -674,6 +680,8 @@ def process_inbox_request(request_json, activitypublog_id, ip_address):
disliked = find_liked_object(target_ap_id) disliked = find_liked_object(target_ap_id)
if user is None: if user is None:
activity_log.exception_message = 'Blocked or unfound user' activity_log.exception_message = 'Blocked or unfound user'
elif disliked is None:
activity_log.exception_message = 'Unfound object'
elif user.is_local(): elif user.is_local():
activity_log.exception_message = 'Activity about local content which is already present' activity_log.exception_message = 'Activity about local content which is already present'
activity_log.result = 'ignored' activity_log.result = 'ignored'