From 64a4048002af61c19c7f86b2d571010d82dcb348 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Mon, 19 Aug 2019 14:35:55 +0100 Subject: [PATCH] Emoji tag icon --- content.py | 8 +++++--- webinterface.py | 12 +++++++----- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/content.py b/content.py index 0a513a969..a3fa40e21 100644 --- a/content.py +++ b/content.py @@ -89,12 +89,14 @@ def addEmoji(baseDir: str,wordStr: str,httpPrefix: str,domain: str,replaceEmoji: return False emojiUrl=httpPrefix+"://"+domain+"/emoji/"+emojiDict[emoji]+'.png' postTags[emoji]= { - 'id': emojiUrl, + 'icon': { + 'mediaType': 'image/png', + 'type': 'Image', + 'url': emojiUrl + }, 'name': ':'+emoji+':', 'type': 'Emoji' } - #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 e8f4605d0..2178b020e 100644 --- a/webinterface.py +++ b/webinterface.py @@ -944,17 +944,19 @@ def htmlRemplaceEmojiFromTags(content: str,tag: {}) -> str: """Uses the tags to replace :emoji: with html image markup """ for tagItem in tag: - if not tagItem.get('id'): - continue if not tagItem.get('type'): continue - if not tagItem.get('name'): - continue if tagItem['type']!='Emoji': continue + if not tagItem.get('name'): + continue + if not tagItem.get('icon'): + continue + if not tagItem['icon'].get('url'): + continue if tagItem['name'] not in content: continue - emojiHtml="\""+tagItem['name'].replace(':','')+"\"" + emojiHtml="\""+tagItem['name'].replace(':','')+"\"" content=content.replace(tagItem['name'],emojiHtml) return content