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'
if not os.path.isfile(followersFile):
return
if not postJsonObject.get('object'):
return
nickname=handle.split('@')[0]
groupname=nickname
domain=handle.split('@')[1]
if ':' in domain:
domain=domain.split(':')[0]
@ -1277,7 +1280,17 @@ def sendToGroupMembers(session,baseDir: str,handle: str,port: int,postJsonObject
for memberHandle in groupMembers:
if memberHandle!=handle:
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
if ':' in memberDomain:
memberPortStr=memberDomain.split(':')[1]