From 2aead37e5cb165647bb742534a078847ec189a0f Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Wed, 3 Nov 2021 22:40:39 +0000 Subject: [PATCH] Ensure that question html gets regenerated after vote --- inbox.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/inbox.py b/inbox.py index 227c50c1a..774da80eb 100644 --- a/inbox.py +++ b/inbox.py @@ -913,7 +913,6 @@ def _receiveUpdateToQuestion(recentPostsCache: {}, messageJson: {}, except BaseException: print('EX: _receiveUpdateToQuestion unable to delete ' + cachedPostFilename) - pass # remove from memory cache removePostFromCache(messageJson, recentPostsCache) @@ -2792,10 +2791,21 @@ def _inboxAfterInitial(recentPostsCache: {}, maxRecentPosts: int, questionJson, questionPostFilename = \ questionUpdateVotes(baseDir, nickname, domain, postJsonObject) if questionJson and questionPostFilename: - removePostFromCache(postJsonObject, recentPostsCache) + removePostFromCache(questionJson, recentPostsCache) # add id to inbox index inboxUpdateIndex('inbox', baseDir, handle, questionPostFilename, debug) + # ensure that the cached post is removed if it exists, so + # that it then will be recreated + cachedPostFilename = \ + getCachedPostFilename(baseDir, nickname, domain, questionJson) + if cachedPostFilename: + if os.path.isfile(cachedPostFilename): + try: + os.remove(cachedPostFilename) + except BaseException: + print('EX: replytoQuestion unable to delete ' + + cachedPostFilename) # Is this a question created by this instance? idPrefix = httpPrefix + '://' + domain if questionJson['object']['id'].startswith(idPrefix):