Ensure that question html gets regenerated after vote

merge-requests/30/head
Bob Mottram 2021-11-03 22:40:39 +00:00
parent 50319d153c
commit 2aead37e5c
1 changed files with 12 additions and 2 deletions

View File

@ -913,7 +913,6 @@ def _receiveUpdateToQuestion(recentPostsCache: {}, messageJson: {},
except BaseException: except BaseException:
print('EX: _receiveUpdateToQuestion unable to delete ' + print('EX: _receiveUpdateToQuestion unable to delete ' +
cachedPostFilename) cachedPostFilename)
pass
# remove from memory cache # remove from memory cache
removePostFromCache(messageJson, recentPostsCache) removePostFromCache(messageJson, recentPostsCache)
@ -2792,10 +2791,21 @@ def _inboxAfterInitial(recentPostsCache: {}, maxRecentPosts: int,
questionJson, questionPostFilename = \ questionJson, questionPostFilename = \
questionUpdateVotes(baseDir, nickname, domain, postJsonObject) questionUpdateVotes(baseDir, nickname, domain, postJsonObject)
if questionJson and questionPostFilename: if questionJson and questionPostFilename:
removePostFromCache(postJsonObject, recentPostsCache) removePostFromCache(questionJson, recentPostsCache)
# add id to inbox index # add id to inbox index
inboxUpdateIndex('inbox', baseDir, handle, inboxUpdateIndex('inbox', baseDir, handle,
questionPostFilename, debug) 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? # Is this a question created by this instance?
idPrefix = httpPrefix + '://' + domain idPrefix = httpPrefix + '://' + domain
if questionJson['object']['id'].startswith(idPrefix): if questionJson['object']['id'].startswith(idPrefix):