From 8142854dfedd9520c9f7c622b671e437a70d8b42 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Fri, 4 Oct 2019 14:31:30 +0100 Subject: [PATCH] Include group name in subject --- inbox.py | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/inbox.py b/inbox.py index 526d51df..6d5f8069 100644 --- a/inbox.py +++ b/inbox.py @@ -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]