From 80ad21deeb420b3194231ce24b935b7264d0d95b Mon Sep 17 00:00:00 2001 From: rimu <3310831+rimu@users.noreply.github.com> Date: Thu, 4 Jan 2024 16:56:37 +1300 Subject: [PATCH] ignore unfound objects when voting --- app/activitypub/routes.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/app/activitypub/routes.py b/app/activitypub/routes.py index fab4bb1a..ae856fe6 100644 --- a/app/activitypub/routes.py +++ b/app/activitypub/routes.py @@ -431,6 +431,8 @@ def process_inbox_request(request_json, activitypublog_id, ip_address): if user is None: activity_log.exception_message = 'Blocked or unfound user' + elif liked is None: + activity_log.exception_message = 'Unfound object' elif user.is_local(): activity_log.exception_message = 'Activity about local content which is already present' 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) if user is None: activity_log.exception_message = 'Blocked or unfound user' + elif disliked is None: + activity_log.exception_message = 'Unfound object' elif user.is_local(): activity_log.exception_message = 'Activity about local content which is already present' 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']) if user is None: activity_log.exception_message = 'Blocked or unfound user' + elif liked is None: + activity_log.exception_message = 'Unfound object' elif user.is_local(): activity_log.exception_message = 'Activity about local content which is already present' 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) if user is None: activity_log.exception_message = 'Blocked or unfound user' + elif disliked is None: + activity_log.exception_message = 'Unfound object' elif user.is_local(): activity_log.exception_message = 'Activity about local content which is already present' activity_log.result = 'ignored'