From 1d642e0d409a092fed8fa9ea5b06cdb2d1cafd28 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Fri, 21 Feb 2020 15:17:55 +0000 Subject: [PATCH] Remove replaced emoji tags --- posts.py | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/posts.py b/posts.py index 0f9367e0..cb8bafca 100644 --- a/posts.py +++ b/posts.py @@ -533,8 +533,20 @@ def createPostBase(baseDir: str,nickname: str,domain: str,port: int, \ nickname,domain,content, \ mentionedRecipients, \ hashtagsDict,True) - content=replaceEmojiFromTags(content,mentionedRecipients,'content') - + + # replace emoji with unicode + tags=[] + for tagName,tag in hashtagsDict.items(): + tags.append(tag) + # get list of tags + content=replaceEmojiFromTags(content,tags,'content') + # remove replaced emoji + for tagName,tag in hashtagsDict.items(): + if tag.get('name'): + if tag['name'].startswith(':'): + if tag['name'] not in content: + del hashtagsDict[tagName] + statusNumber,published = getStatusNumber() postTo='https://www.w3.org/ns/activitystreams#Public' postCC=httpPrefix+'://'+domain+'/users/'+nickname+'/followers'