From aa0656f3dc9164b36b6c1b048014504d0f69d926 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Mon, 30 Sep 2019 20:13:14 +0100 Subject: [PATCH] Obtain actor for announces --- inbox.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/inbox.py b/inbox.py index 72842396..7f77aa4a 100644 --- a/inbox.py +++ b/inbox.py @@ -977,7 +977,17 @@ def receiveAnnounce(session,handle: str,baseDir: str, \ updateAnnounceCollection(postFilename,messageJson['actor'],debug) if debug: print('DEBUG: Downloading announce post '+messageJson['object']) - downloadAnnounce(session,baseDir,httpPrefix,nickname,domain,messageJson,__version__) + postJsonObject=downloadAnnounce(session,baseDir,httpPrefix,nickname,domain,messageJson,__version__) + if postJsonObject: + # Try to obtain the actor for this person + # so that their avatar can be shown + lookupActor=None + if postJsonObject.get('object'): + if isinstance(postJsonObject['object'], dict): + if postJsonObject['object'].get('attributedTo'): + lookupActor=postJsonObject['object']['attributedTo'] + if lookupActor: + getPersonFromCache(baseDir,lookupActor,personCache) if debug: print('DEBUG: announced/repeated post arrived in inbox') return True