Include group name in subject

main2
Bob Mottram 2019-10-04 14:31:30 +01:00
parent 43cdb1e4be
commit 8142854dfe
1 changed files with 14 additions and 1 deletions

View File

@ -1269,7 +1269,10 @@ def sendToGroupMembers(session,baseDir: str,handle: str,port: int,postJsonObject
followersFile=baseDir+'/accounts/'+handle+'/followers.txt' followersFile=baseDir+'/accounts/'+handle+'/followers.txt'
if not os.path.isfile(followersFile): if not os.path.isfile(followersFile):
return return
if not postJsonObject.get('object'):
return
nickname=handle.split('@')[0] nickname=handle.split('@')[0]
groupname=nickname
domain=handle.split('@')[1] domain=handle.split('@')[1]
if ':' in domain: if ':' in domain:
domain=domain.split(':')[0] domain=domain.split(':')[0]
@ -1277,7 +1280,17 @@ def sendToGroupMembers(session,baseDir: str,handle: str,port: int,postJsonObject
for memberHandle in groupMembers: for memberHandle in groupMembers:
if memberHandle!=handle: if memberHandle!=handle:
memberNickname=memberHandle.split('@')[0] memberNickname=memberHandle.split('@')[0]
memberDomain=memberHandle.split('@')[0] memberDomain=memberHandle.split('@')[1]
# set the recipient
postJsonObject['object']['to']=[httpPrefix+'://'+memberDomain+'/users/'+memberNickname]
postJsonObject['object']['cc']=[]
# set subject including group name
postJsonObject['object']['sensitive']=True
if postJsonObject['object'].get('summary'):
if not postJsonObject['object']['summary'].startswith(groupname+': '):
postJsonObject['object']['summary']=groupname+': '+postJsonObject['object']['summary']
else:
postJsonObject['object']['summary']=groupname
memberPort=port memberPort=port
if ':' in memberDomain: if ':' in memberDomain:
memberPortStr=memberDomain.split(':')[1] memberPortStr=memberDomain.split(':')[1]