From 08f19f2e8df4b4bc94fa2ff9412f4b99e750548a Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Sun, 3 May 2020 10:56:29 +0000 Subject: [PATCH] Commit ActivityPub type --- git.py | 4 ++++ inbox.py | 1 + outbox.py | 1 + posts.py | 2 ++ 4 files changed, 8 insertions(+) diff --git a/git.py b/git.py index 368e5baf8..452b8a738 100644 --- a/git.py +++ b/git.py @@ -41,9 +41,13 @@ def getGitProjectName(baseDir: str, nickname: str, domain: str, def isGitPatch(baseDir: str, nickname: str, domain: str, + messageType: str, subject: str, content: str) -> bool: """Is the given post content a git patch? """ + if messageType != 'Note' and \ + messageType != 'Commit': + return False # must have a subject line if not subject: return False diff --git a/inbox.py b/inbox.py index 1b4cc2108..1730cb23b 100644 --- a/inbox.py +++ b/inbox.py @@ -1581,6 +1581,7 @@ def validPostContent(baseDir: str, nickname: str, domain: str, if 'Z' not in messageJson['object']['published']: return False if isGitPatch(baseDir, nickname, domain, + messageJson['object']['type'], messageJson['object']['summary'], messageJson['object']['content']): return True diff --git a/outbox.py b/outbox.py index 39b759200..333206b8b 100644 --- a/outbox.py +++ b/outbox.py @@ -188,6 +188,7 @@ def postMessageToOutbox(messageJson: {}, postToNickname: str, messageJson['type'] == 'Question' or \ messageJson['type'] == 'Note' or \ messageJson['type'] == 'Article' or \ + messageJson['type'] == 'Commit' or \ messageJson['type'] == 'Announce': indexes = [outboxName, "inbox"] for boxNameIndex in indexes: diff --git a/posts.py b/posts.py index 1da6411a1..e64be8b86 100644 --- a/posts.py +++ b/posts.py @@ -2251,6 +2251,7 @@ def isDM(postJsonObject: {}) -> bool: if not isinstance(postJsonObject['object'], dict): return False if postJsonObject['object']['type'] != 'Note' and \ + postJsonObject['object']['type'] != 'Commit' and \ postJsonObject['object']['type'] != 'Article': return False if postJsonObject['object'].get('moderationStatus'): @@ -2427,6 +2428,7 @@ def addPostStringToTimeline(postStr: str, boxname: str, # must be a "Note" or "Announce" type if ('"Note"' in postStr or '"Article"' in postStr or + '"Commit"' in postStr or '"Announce"' in postStr or ('"Question"' in postStr and ('"Create"' in postStr or '"Update"' in postStr))):