From 2493139d7bb3696938c91eaf21eb3a1dbc1689ee Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Sun, 1 Mar 2020 20:15:07 +0000 Subject: [PATCH] Format edited blog content --- daemon.py | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/daemon.py b/daemon.py index dbe03482b..78d732d40 100644 --- a/daemon.py +++ b/daemon.py @@ -172,6 +172,7 @@ from manualapprove import manualDenyFollowRequest from manualapprove import manualApproveFollowRequest from announce import createAnnounce from announce import outboxAnnounce +from content import replaceEmojiFromTags from content import addHtmlTags from content import extractMediaInFormPOST from content import saveMediaInFormPOST @@ -3936,8 +3937,29 @@ class PubServer(BaseHTTPRequestHandler): os.remove(cachedFilename) except: pass + # remove from memory cache + removePostFromCache(postJsonObject, \ + self.server.recentPostsCache) + # change the blog post title postJsonObject['object']['summary']=fields['subject'] - # TODO format message + # format message + tags=[] + hashtagsDict={} + fields['message']= \ + addHtmlTags(self.server.baseDir, \ + self.server.httpPrefix, \ + nickname,self.server.domain, \ + fields['message'], \ + mentionedRecipients, \ + hashtagsDict,True) + # replace emoji with unicode + tags=[] + for tagName,tag in hashtagsDict.items(): + tags.append(tag) + # get list of tags + fields['message']= \ + replaceEmojiFromTags(fields['message'],tags,'content') + postJsonObject['object']['content']=fields['message'] saveJson(postJsonObject,postFilename) print('Edited blog post, resaved '+postFilename)