Check if mention exists

main2
Bob Mottram 2019-10-04 16:17:48 +01:00
parent 5b1692a3c7
commit 193ac8916c
1 changed files with 14 additions and 5 deletions

View File

@ -1311,11 +1311,20 @@ def sendToGroupMembers(session,baseDir: str,handle: str,port: int,postJsonObject
# add mention to tag list
if not postJsonObject['object']['tag']:
postJsonObject['object']['tag']=[]
postJsonObject['object']['tag'].append({
'href': sendingActor,
'name': senderStr,
'type': 'Mention'
})
# check if the mention already exists
mentionExists=False
for mention in postJsonObject['object']['tag']:
if mention['type']=='Mention':
if mention.get('href'):
if mention['href']==sendingActor:
mentionExists=True
if not mentionExists:
# add the mention of the original sender
postJsonObject['object']['tag'].append({
'href': sendingActor,
'name': senderStr,
'type': 'Mention'
})
postJsonObject['actor']=httpPrefix+'://'+domainFull+'/users/'+nickname
postJsonObject['to']=[httpPrefix+'://'+domainFull+'/users/'+nickname+'/followers']