Add mention for sender to posts sent to group members

main2
Bob Mottram 2019-10-04 15:36:53 +01:00
parent 5fbaf00b04
commit 542f3267a1
1 changed files with 9 additions and 2 deletions

View File

@ -1304,8 +1304,15 @@ def sendToGroupMembers(session,baseDir: str,handle: str,port: int,postJsonObject
if sendingActorPort:
if sendingActorPort!=80 and sendingActorPort!=443:
sendingActorDomainFull=sendingActorDomain+':'+str(sendingActorPort)
if not postJsonObject['object']['content'].startswith('@'+sendingActorNickname+'@'+sendingActorDomainFull):
postJsonObject['object']['content']='@'+sendingActorNickname+'@'+sendingActorDomainFull+' '+postJsonObject['object']['content']
senderStr='@'+sendingActorNickname+'@'+sendingActorDomainFull
if not postJsonObject['object']['content'].startswith(senderStr):
postJsonObject['object']['content']=senderStr+' '+postJsonObject['object']['content']
# add mention to tag list
postJsonObject['object']['tag'].append({
'href': sendingActor,
'name': senderStr,
'type': 'Mention'
}
postJsonObject['actor']=[httpPrefix+'://'+domain+'/users/'+nickname]
postJsonObject['to']=[httpPrefix+'://'+domain+'/users/'+nickname+'/followers']