Add muted field

main
Bob Mottram 2019-12-01 16:15:41 +00:00
parent 38c2a713ca
commit c29dbe4dae
2 changed files with 4 additions and 2 deletions

View File

@ -509,6 +509,7 @@ def updateRecentPostsCache(recentPostsCache: {},maxRecentPosts: int, \
if postId in recentPostsCache['index']: if postId in recentPostsCache['index']:
return return
recentPostsCache['index'].append(postId) recentPostsCache['index'].append(postId)
postJsonObject['muted']=False
recentPostsCache['json'][postId]=json.dumps(postJsonObject) recentPostsCache['json'][postId]=json.dumps(postJsonObject)
recentPostsCache['html'][postId]=htmlStr recentPostsCache['html'][postId]=htmlStr

View File

@ -1998,8 +1998,9 @@ def preparePostFromHtmlCache(postHtml: str,boxName: str,pageNumber: int) -> str:
def postIsMuted(baseDir: str,nickname: str,domain: str, postJsonObject: {},messageId: str) -> bool: def postIsMuted(baseDir: str,nickname: str,domain: str, postJsonObject: {},messageId: str) -> bool:
""" Returns true if the given post is muted """ Returns true if the given post is muted
""" """
if postJsonObject.get('muted'): isMuted=postJsonObject.get('muted')
return True if isMuted==True or isMuted==False:
return isMuted
postDir=baseDir+'/accounts/'+nickname+'@'+domain postDir=baseDir+'/accounts/'+nickname+'@'+domain
muteFilename=postDir+'/inbox/'+messageId.replace('/','#')+'.json.muted' muteFilename=postDir+'/inbox/'+messageId.replace('/','#')+'.json.muted'
if os.path.isfile(muteFilename): if os.path.isfile(muteFilename):