From ca1781a33f286be408dc06b2e2bfc7d86f8c9245 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Tue, 11 Jul 2023 13:02:58 +0100 Subject: [PATCH] Improve pending Followers collection --- follow.py | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/follow.py b/follow.py index c56b25468..f3472a03c 100644 --- a/follow.py +++ b/follow.py @@ -1581,9 +1581,20 @@ def pending_followers_timeline_json(actor: str, base_dir: str, if len(follower_handle) == 0: continue follower_handle = remove_eol(follower_handle) - foll_json = { - "type": "Follow", - "actor": follower_handle - } - result_json['orderedItems'].append(foll_json) + foll_domain, _ = get_domain_from_actor(follower_handle) + if not foll_domain: + continue + foll_nickname = get_nickname_from_actor(follower_handle) + if not foll_nickname: + continue + follow_activity_filename = \ + acct_dir(base_dir, nickname, domain) + \ + '/requests/' + \ + foll_nickname + '@' + foll_domain + '.follow' + if not os.path.isfile(follow_activity_filename): + continue + follow_json = load_json(follow_activity_filename) + if not follow_json: + continue + result_json['orderedItems'].append(follow_json) return result_json