forked from indymedia/epicyon
Commit ActivityPub type
parent
7c6b2fd05f
commit
08f19f2e8d
4
git.py
4
git.py
|
@ -41,9 +41,13 @@ def getGitProjectName(baseDir: str, nickname: str, domain: str,
|
||||||
|
|
||||||
|
|
||||||
def isGitPatch(baseDir: str, nickname: str, domain: str,
|
def isGitPatch(baseDir: str, nickname: str, domain: str,
|
||||||
|
messageType: str,
|
||||||
subject: str, content: str) -> bool:
|
subject: str, content: str) -> bool:
|
||||||
"""Is the given post content a git patch?
|
"""Is the given post content a git patch?
|
||||||
"""
|
"""
|
||||||
|
if messageType != 'Note' and \
|
||||||
|
messageType != 'Commit':
|
||||||
|
return False
|
||||||
# must have a subject line
|
# must have a subject line
|
||||||
if not subject:
|
if not subject:
|
||||||
return False
|
return False
|
||||||
|
|
1
inbox.py
1
inbox.py
|
@ -1581,6 +1581,7 @@ def validPostContent(baseDir: str, nickname: str, domain: str,
|
||||||
if 'Z' not in messageJson['object']['published']:
|
if 'Z' not in messageJson['object']['published']:
|
||||||
return False
|
return False
|
||||||
if isGitPatch(baseDir, nickname, domain,
|
if isGitPatch(baseDir, nickname, domain,
|
||||||
|
messageJson['object']['type'],
|
||||||
messageJson['object']['summary'],
|
messageJson['object']['summary'],
|
||||||
messageJson['object']['content']):
|
messageJson['object']['content']):
|
||||||
return True
|
return True
|
||||||
|
|
|
@ -188,6 +188,7 @@ def postMessageToOutbox(messageJson: {}, postToNickname: str,
|
||||||
messageJson['type'] == 'Question' or \
|
messageJson['type'] == 'Question' or \
|
||||||
messageJson['type'] == 'Note' or \
|
messageJson['type'] == 'Note' or \
|
||||||
messageJson['type'] == 'Article' or \
|
messageJson['type'] == 'Article' or \
|
||||||
|
messageJson['type'] == 'Commit' or \
|
||||||
messageJson['type'] == 'Announce':
|
messageJson['type'] == 'Announce':
|
||||||
indexes = [outboxName, "inbox"]
|
indexes = [outboxName, "inbox"]
|
||||||
for boxNameIndex in indexes:
|
for boxNameIndex in indexes:
|
||||||
|
|
2
posts.py
2
posts.py
|
@ -2251,6 +2251,7 @@ def isDM(postJsonObject: {}) -> bool:
|
||||||
if not isinstance(postJsonObject['object'], dict):
|
if not isinstance(postJsonObject['object'], dict):
|
||||||
return False
|
return False
|
||||||
if postJsonObject['object']['type'] != 'Note' and \
|
if postJsonObject['object']['type'] != 'Note' and \
|
||||||
|
postJsonObject['object']['type'] != 'Commit' and \
|
||||||
postJsonObject['object']['type'] != 'Article':
|
postJsonObject['object']['type'] != 'Article':
|
||||||
return False
|
return False
|
||||||
if postJsonObject['object'].get('moderationStatus'):
|
if postJsonObject['object'].get('moderationStatus'):
|
||||||
|
@ -2427,6 +2428,7 @@ def addPostStringToTimeline(postStr: str, boxname: str,
|
||||||
# must be a "Note" or "Announce" type
|
# must be a "Note" or "Announce" type
|
||||||
if ('"Note"' in postStr or
|
if ('"Note"' in postStr or
|
||||||
'"Article"' in postStr or
|
'"Article"' in postStr or
|
||||||
|
'"Commit"' in postStr or
|
||||||
'"Announce"' in postStr or
|
'"Announce"' in postStr or
|
||||||
('"Question"' in postStr and
|
('"Question"' in postStr and
|
||||||
('"Create"' in postStr or '"Update"' in postStr))):
|
('"Create"' in postStr or '"Update"' in postStr))):
|
||||||
|
|
Loading…
Reference in New Issue