More debug for mute

main
Bob Mottram 2020-08-31 10:16:49 +01:00
parent 329c86e731
commit 74fd37ee00
1 changed files with 15 additions and 3 deletions

View File

@ -3546,12 +3546,19 @@ def mutePost(baseDir: str, nickname: str, domain: str, postId: str,
if newCacheFile: if newCacheFile:
newCacheFile.write(postHtml) newCacheFile.write(postHtml)
newCacheFile.close() newCacheFile.close()
print('MUTE: ' + cachedPostFilename +
' icon changed')
else:
print('MUTE: ' + cachedPostFilename +
' icon not changed')
else:
print('MUTE: ' + cachedPostFilename + ' not cached to file')
print('MUTE: ' + postFilename)
muteFile = open(postFilename + '.muted', 'w+') muteFile = open(postFilename + '.muted', 'w+')
if muteFile: if muteFile:
muteFile.write('\n') muteFile.write('\n')
muteFile.close() muteFile.close()
print('MUTE: ' + postFilename + '.muted file added')
# if the post is in the recent posts cache then mark it as muted # if the post is in the recent posts cache then mark it as muted
if recentPostsCache.get('index'): if recentPostsCache.get('index'):
@ -3569,7 +3576,7 @@ def mutePost(baseDir: str, nickname: str, domain: str, postId: str,
recentPostsCache['html'][postId] = \ recentPostsCache['html'][postId] = \
postHtml.replace('/unmute.png', '/mute.png') postHtml.replace('/unmute.png', '/mute.png')
print('MUTE: ' + postId + print('MUTE: ' + postId +
' marked as muted in recent posts cache') ' marked as muted in recent posts memory cache')
def unmutePost(baseDir: str, nickname: str, domain: str, postId: str, def unmutePost(baseDir: str, nickname: str, domain: str, postId: str,
@ -3583,10 +3590,10 @@ def unmutePost(baseDir: str, nickname: str, domain: str, postId: str,
if not postJsonObject: if not postJsonObject:
return return
print('UNMUTE: ' + postFilename)
muteFilename = postFilename + '.muted' muteFilename = postFilename + '.muted'
if os.path.isfile(muteFilename): if os.path.isfile(muteFilename):
os.remove(muteFilename) os.remove(muteFilename)
print('UNMUTE: ' + muteFilename + ' file removed')
# change the mute icon in the cached post file # change the mute icon in the cached post file
cachedPostFilename = \ cachedPostFilename = \
@ -3600,6 +3607,11 @@ def unmutePost(baseDir: str, nickname: str, domain: str, postId: str,
if newCacheFile: if newCacheFile:
newCacheFile.write(postHtml) newCacheFile.write(postHtml)
newCacheFile.close() newCacheFile.close()
else:
print('MUTE: ' + cachedPostFilename +
' icon not changed')
else:
print('MUTE: ' + cachedPostFilename + ' not cached to file')
# if the post is in the recent posts cache then mark it as muted # if the post is in the recent posts cache then mark it as muted
if recentPostsCache.get('index'): if recentPostsCache.get('index'):