master
Bob Mottram 2019-08-19 11:46:23 +01:00
parent 021048950f
commit 2923e74db1
1 changed files with 9 additions and 8 deletions

View File

@ -122,12 +122,13 @@ def addMention(wordStr: str,httpPrefix: str,following: str,replaceMentions: {},r
possibleNickname=possibleHandle.split('@')[0] possibleNickname=possibleHandle.split('@')[0]
possibleDomain=possibleHandle.split('@')[1].strip('\n') possibleDomain=possibleHandle.split('@')[1].strip('\n')
for follow in following: for follow in following:
if follow.replace('\n','')==possibleHandle: if follow.replace('\n','')!=possibleHandle:
recipientActor=httpPrefix+"://"+possibleDomain+"/users/"+possibleNickname continue
if recipientActor not in recipients: recipientActor=httpPrefix+"://"+possibleDomain+"/users/"+possibleNickname
recipients.append(recipientActor) if recipientActor not in recipients:
replaceMentions[wordStr]="<span class=\"h-card\"><a href=\""+httpPrefix+"://"+possibleDomain+"/@"+possibleNickname+"\" class=\"u-url mention\">@<span>"+possibleNickname+"</span></a></span>" recipients.append(recipientActor)
return True replaceMentions[wordStr]="<span class=\"h-card\"><a href=\""+httpPrefix+"://"+possibleDomain+"/@"+possibleNickname+"\" class=\"u-url mention\">@<span>"+possibleNickname+"</span></a></span>"
return True
# @nick@domain # @nick@domain
if '@' in possibleHandle: if '@' in possibleHandle:
if not (possibleDomain=='localhost' or '.' in possibleDomain): if not (possibleDomain=='localhost' or '.' in possibleDomain):
@ -135,8 +136,8 @@ def addMention(wordStr: str,httpPrefix: str,following: str,replaceMentions: {},r
recipientActor=httpPrefix+"://"+possibleDomain+"/users/"+possibleNickname recipientActor=httpPrefix+"://"+possibleDomain+"/users/"+possibleNickname
if recipientActor not in recipients: if recipientActor not in recipients:
recipients.append(recipientActor) recipients.append(recipientActor)
replaceMentions[wordStr]="<span class=\"h-card\"><a href=\""+httpPrefix+"://"+possibleDomain+"/@"+possibleNickname+"\" class=\"u-url mention\">@<span>"+possibleNickname+"</span></a></span>" replaceMentions[wordStr]="<span class=\"h-card\"><a href=\""+httpPrefix+"://"+possibleDomain+"/@"+possibleNickname+"\" class=\"u-url mention\">@<span>"+possibleNickname+"</span></a></span>"
return True return True
return False return False
def addHtmlTags(baseDir: str,httpPrefix: str, \ def addHtmlTags(baseDir: str,httpPrefix: str, \