From 3302fdfa6cc3c7ba941a418923e828ff6368291a Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Wed, 19 Feb 2020 17:57:59 +0000 Subject: [PATCH] Support Article activity type --- outbox.py | 1 + posts.py | 14 +++++++++----- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/outbox.py b/outbox.py index 6d142695..b795bba3 100644 --- a/outbox.py +++ b/outbox.py @@ -165,6 +165,7 @@ def postMessageToOutbox(messageJson: {},postToNickname: str, \ if messageJson['type']=='Create' or \ messageJson['type']=='Question' or \ messageJson['type']=='Note' or \ + messageJson['type']=='Article' or \ messageJson['type']=='Announce': inboxUpdateIndex('outbox',baseDir, \ postToNickname+'@'+domain, \ diff --git a/posts.py b/posts.py index 77dd61c9..7f776ea2 100644 --- a/posts.py +++ b/posts.py @@ -2023,7 +2023,8 @@ def isDM(postJsonObject: {}) -> bool: return False if not isinstance(postJsonObject['object'], dict): return False - if postJsonObject['object']['type']!='Note': + if postJsonObject['object']['type']!='Note' and \ + postJsonObject['object']['type']!='Article': return False if postJsonObject['object'].get('moderationStatus'): return False @@ -2056,7 +2057,8 @@ def isImageMedia(session,baseDir: str,httpPrefix: str, \ return False if postJsonObject['object'].get('moderationStatus'): return False - if postJsonObject['object']['type']!='Note': + if postJsonObject['object']['type']!='Note' and \ + postJsonObject['object']['type']!='Article': return False if not postJsonObject['object'].get('attachment'): return False @@ -2081,7 +2083,8 @@ def isReply(postJsonObject: {},actor: str) -> bool: return False if postJsonObject['object'].get('moderationStatus'): return False - if postJsonObject['object']['type']!='Note': + if postJsonObject['object']['type']!='Note' and \ + postJsonObject['object']['type']!='Article': return False if postJsonObject['object'].get('inReplyTo'): if postJsonObject['object']['inReplyTo'].startswith(actor): @@ -2188,7 +2191,7 @@ def addPostStringToTimeline(postStr: str,boxname: str, \ """ is this a valid timeline post? """ # must be a "Note" or "Announce" type - if '"Note"' in postStr or '"Announce"' in postStr or \ + if '"Note"' in postStr '"Article"' in postStr or '"Announce"' in postStr or \ ('"Question"' in postStr and ('"Create"' in postStr or '"Update"' in postStr)): if boxname=='dm': @@ -2718,7 +2721,8 @@ def downloadAnnounce(session,baseDir: str,httpPrefix: str, \ rejectAnnounce(announceFilename) #pprint(announcedJson) return None - if announcedJson['type']!='Note': + if announcedJson['type']!='Note' and \ + announcedJson['type']!='Article': rejectAnnounce(announceFilename) #pprint(announcedJson) return None