From 218693f7b17e89a252646e62fcfe14032c55583d Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Mon, 23 Sep 2019 12:34:24 +0100 Subject: [PATCH] Replace emoji tags --- content.py | 6 ++++-- webinterface.py | 8 ++++++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/content.py b/content.py index 036f660fd..e7b595028 100644 --- a/content.py +++ b/content.py @@ -111,7 +111,7 @@ def loadEmojiDict(emojiDataFilename: str,emojiDict: {}) -> None: emojiName=emojiName.split('..')[0] emojiDict[emojiName.lower()]=emojiUnicode -def addEmoji(baseDir: str,wordStr: str,httpPrefix: str,domain: str,replaceEmoji: {},postTags: {},emojiDict: {}) -> bool: +def addEmoji(baseDir: str,wordStr: str,httpPrefix: str,domain: str,replaceEmoji: {},postTags: {},emojiDict: {},inMessageContent: bool) -> bool: """Detects Emoji and adds them to the replacements dict Also updates the tags list to be added to the post """ @@ -144,7 +144,9 @@ def addEmoji(baseDir: str,wordStr: str,httpPrefix: str,domain: str,replaceEmoji: 'name': ':'+emoji+':', 'type': 'Emoji' } - replaceEmoji[wordStr]=''+emoji+'' + if not inMessageContent: + # when altering emoji in display name + replaceEmoji[wordStr]=''+emoji+'' return True def addMention(wordStr: str,httpPrefix: str,following: str,replaceMentions: {},recipients: [],tags: {}) -> bool: diff --git a/webinterface.py b/webinterface.py index cffe76be3..2a027fa81 100644 --- a/webinterface.py +++ b/webinterface.py @@ -1745,10 +1745,12 @@ def individualPostAsHtml(iconsDir: str,translate: {}, \ if displayName: if ':' in displayName: displayName=displayName.replace('

','').replace('

','') + emojiTags={} displayName= \ addHtmlTags(baseDir,httpPrefix, \ - nickname,domain,displayName,[],{}) + nickname,domain,displayName,[],emojiTags) displayName=displayName.replace('

','').replace('

','') + displayName=htmlRemplaceEmojiFromTags(displayName,emojiTags) titleStr+=''+displayName+'' else: titleStr+='@'+actorNickname+'@'+actorDomain+'' @@ -1873,10 +1875,12 @@ def individualPostAsHtml(iconsDir: str,translate: {}, \ if displayName: if ':' in displayName: displayName=displayName.replace('

','').replace('

','') + emojiTags={} displayName= \ addHtmlTags(baseDir,httpPrefix, \ - nickname,domain,displayName,[],{}) + nickname,domain,displayName,[],emojiTags) displayName=displayName.replace('

','').replace('

','') + displayName=htmlRemplaceEmojiFromTags(displayName,emojiTags) titleStr=displayName+' '+titleStr avatarImageInPost= \