Avoid duplicates

main2
Bob Mottram 2019-09-22 18:54:33 +01:00
parent e8510d5385
commit b92f4570a9
2 changed files with 7 additions and 4 deletions

View File

@ -284,5 +284,6 @@ def getMentionsFromHtml(htmlText: str,matchStr="<span class=\"h-card\"><a href=\
actorStr=mentionStr.split('"')[0]
if actorStr.startswith('http') or \
actorStr.startswith('dat:'):
mentions.append(actorStr)
if actorStr not in mentions:
mentions.append(actorStr)
return mentions

View File

@ -934,10 +934,12 @@ def htmlNewPost(translate: {},baseDir: str, \
mentionDomain,mentionPort=getDomainFromActor(m)
if not mentionDomain:
continue
if mentionPort:
mentionsStr+='@'+mentionNickname+'@'+mentionDomain+':'+str(mentionPort)+' '
if mentionPort:
mentionsHandle='@'+mentionNickname+'@'+mentionDomain+':'+str(mentionPort)
else:
mentionsStr+='@'+mentionNickname+'@'+mentionDomain+' '
mentionsHandle='@'+mentionNickname+'@'+mentionDomain
if mentionsHandle not in mentionsStr:
mentionsStr+=mentionsHandle+' '
# build suffixes so that any replies or mentions are preserved when switching between scopes
dropdownNewPostSuffix='/newpost'