apf part 15: Flag requests

This commit is contained in:
freamon 2024-11-19 12:02:15 +00:00
parent 5f96034581
commit 9bca07504e
2 changed files with 11 additions and 1 deletions

View file

@ -749,6 +749,16 @@ def process_inbox_request(request_json, store_ap_json):
process_downvote(user, store_ap_json, request_json, announced=False)
return
if request_json['type'] == 'Flag': # Reported content
reported = find_reported_object(request_json['object'])
if reported:
process_report(user, reported, request_json)
log_incoming_ap(request_json['id'], APLOG_REPORT, APLOG_SUCCESS, request_json if store_ap_json else None)
announce_activity_to_followers(reported.community, user, request_json)
else:
log_incoming_ap(request_json['id'], APLOG_REPORT, APLOG_IGNORED, request_json if store_ap_json else None, 'Report ignored due to missing content')
return
# -- below this point is code that will be incrementally replaced to use log_incoming_ap() instead --

View file

@ -1987,7 +1987,7 @@ def undo_vote(activity_log, comment, post, target_ap_id, user):
return None
def process_report(user, reported, request_json, activity_log):
def process_report(user, reported, request_json):
if len(request_json['summary']) < 15:
reasons = request_json['summary']
description = ''