From 300692de194a2476c0e615822fe3f926b7d1c24e Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Sun, 18 Oct 2020 17:24:28 +0100 Subject: [PATCH] Clear post caches when editing news --- daemon.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/daemon.py b/daemon.py index cd18ef8cb..734cca576 100644 --- a/daemon.py +++ b/daemon.py @@ -164,6 +164,7 @@ from shares import getSharesFeedForPerson from shares import addShare from shares import removeShare from shares import expireShares +from utils import clearFromPostCaches from utils import containsInvalidChars from utils import isSystemAccount from utils import setConfigParam @@ -3124,13 +3125,6 @@ class PubServer(BaseHTTPRequestHandler): newsPostTitle postJsonObject['object']['content'] = \ newsPostContent - # remove the html from post cache - cachedPost = \ - baseDir + '/accounts/' + \ - nickname + '@' + domain + \ - '/postcache/' + newsPostUrl + '.html' - if os.path.isfile(cachedPost): - os.remove(cachedPost) # update newswire pubDate = postJsonObject['object']['published'] publishedDate = \ @@ -3149,6 +3143,12 @@ class PubServer(BaseHTTPRequestHandler): newswireStateFilename) except Exception as e: print('ERROR saving newswire state, ' + str(e)) + + # remove any previous cached news posts + newsId = \ + postJsonObject['object']['id'].replace('/', '#') + clearFromPostCaches(baseDir, newsId) + # save the news post saveJson(postJsonObject, postFilename)