Adding mentioned recipients to 'to'

master
Bob Mottram 2019-08-19 10:37:14 +01:00
parent 00e3a094e3
commit 2fdd5036a4
1 changed files with 9 additions and 8 deletions

View File

@ -427,7 +427,9 @@ def createPostBase(baseDir: str,nickname: str, domain: str, port: int, \
inReplyToAtomUri=None, subject=None) -> {}: inReplyToAtomUri=None, subject=None) -> {}:
"""Creates a message """Creates a message
""" """
mentionedRecipients=[] mentionedRecipients= \
getMentionedPeople(baseDir,httpPrefix,content,domain,False)
tags=[] tags=[]
hashtagsDict={} hashtagsDict={}
@ -465,7 +467,10 @@ def createPostBase(baseDir: str,nickname: str, domain: str, port: int, \
return None return None
# who to send to # who to send to
toRecipients=[toUrl] + mentionedRecipients toRecipients=[toUrl]
for mention in mentionedRecipients:
if mention not in toRecipients:
toRecipients.append(mention)
# create a list of hashtags # create a list of hashtags
if hashtagsDict: if hashtagsDict:
@ -800,14 +805,10 @@ def createDirectMessagePost(baseDir: str,
mentionedPeople=getMentionedPeople(baseDir,httpPrefix,content,domain,debug) mentionedPeople=getMentionedPeople(baseDir,httpPrefix,content,domain,debug)
if debug: if debug:
print('mentionedPeople: '+str(mentionedPeople)) print('mentionedPeople: '+str(mentionedPeople))
postTo=None
postCc=None
if not mentionedPeople: if not mentionedPeople:
return None return None
if len(mentionedPeople)==1: postTo=None
postTo=mentionedPeople[0] postCc=None
if len(mentionedPeople)>1:
postCc=mentionedPeople[1]
return createPostBase(baseDir,nickname, domain, port, \ return createPostBase(baseDir,nickname, domain, port, \
postTo,postCc, \ postTo,postCc, \
httpPrefix, content, followersOnly, saveToFile, \ httpPrefix, content, followersOnly, saveToFile, \