More descriptive git patch notification message

main
Bob Mottram 2020-05-03 09:58:51 +00:00
parent 5dcc60aa7c
commit 4fc5afde9c
1 changed files with 7 additions and 3 deletions

View File

@ -1699,15 +1699,18 @@ def replyNotify(baseDir: str, handle: str, url: str) -> None:
def gitPatchNotify(baseDir: str, handle: str, def gitPatchNotify(baseDir: str, handle: str,
subject: str, content: str) -> None: subject: str, content: str,
fromNickname: str, fromDomain: str) -> None:
"""Creates a notification that a new git patch has arrived """Creates a notification that a new git patch has arrived
""" """
accountDir = baseDir + '/accounts/' + handle accountDir = baseDir + '/accounts/' + handle
if not os.path.isdir(accountDir): if not os.path.isdir(accountDir):
return return
patchFile = accountDir + '/.newPatch' patchFile = accountDir + '/.newPatch'
subject = subject.replace('[PATCH]', '').strip()
handle = '@' + fromNickname + '@' + fromDomain
with open(patchFile, 'w') as fp: with open(patchFile, 'w') as fp:
fp.write(subject) fp.write('git ' + handle + ' ' + subject)
def groupHandle(baseDir: str, handle: str) -> bool: def groupHandle(baseDir: str, handle: str) -> bool:
@ -2063,7 +2066,8 @@ def inboxAfterCapabilities(recentPostsCache: {}, maxRecentPosts: int,
fromNickname, fromDomain): fromNickname, fromDomain):
gitPatchNotify(baseDir, handle, gitPatchNotify(baseDir, handle,
postJsonObject['object']['summary'], postJsonObject['object']['summary'],
postJsonObject['object']['content']) postJsonObject['object']['content'],
fromNickname, fromDomain)
elif '[PATCH]' in postJsonObject['object']['content']: elif '[PATCH]' in postJsonObject['object']['content']:
print('WARN: git patch not accepted - ' + print('WARN: git patch not accepted - ' +
postJsonObject['object']['summary']) postJsonObject['object']['summary'])