mirror of https://gitlab.com/bashrc2/epicyon
Check for difference in muted state of a post
parent
59dc05b0fc
commit
ac5ac44e28
|
@ -1180,6 +1180,24 @@ def _getFooterWithIcons(showIcons: bool,
|
||||||
return footerStr
|
return footerStr
|
||||||
|
|
||||||
|
|
||||||
|
def _htmlMutedStateChanged(postJsonObject: {}, postHtml: str) -> bool:
|
||||||
|
"""Returns true if the muted status of a post is different between the
|
||||||
|
json and the html
|
||||||
|
"""
|
||||||
|
postJsonObj = postJsonObject
|
||||||
|
if hasObjectDict(postJsonObject):
|
||||||
|
postJsonObj = postJsonObject['object']
|
||||||
|
if 'muted' not in postJsonObj:
|
||||||
|
return False
|
||||||
|
if postJsonObj['muted'] is False:
|
||||||
|
if '?unmute=' in postHtml:
|
||||||
|
return True
|
||||||
|
else:
|
||||||
|
if '?mute=' in postHtml:
|
||||||
|
return True
|
||||||
|
return False
|
||||||
|
|
||||||
|
|
||||||
def individualPostAsHtml(signingPrivateKeyPem: str,
|
def individualPostAsHtml(signingPrivateKeyPem: str,
|
||||||
allowDownloads: bool,
|
allowDownloads: bool,
|
||||||
recentPostsCache: {}, maxRecentPosts: int,
|
recentPostsCache: {}, maxRecentPosts: int,
|
||||||
|
@ -1261,7 +1279,8 @@ def individualPostAsHtml(signingPrivateKeyPem: str,
|
||||||
maxRecentPosts,
|
maxRecentPosts,
|
||||||
signingPrivateKeyPem)
|
signingPrivateKeyPem)
|
||||||
if postHtml:
|
if postHtml:
|
||||||
return postHtml
|
if not _htmlMutedStateChanged(postJsonObject, postHtml):
|
||||||
|
return postHtml
|
||||||
if useCacheOnly and postJsonObject['type'] != 'Announce':
|
if useCacheOnly and postJsonObject['type'] != 'Announce':
|
||||||
return ''
|
return ''
|
||||||
|
|
||||||
|
@ -1389,7 +1408,8 @@ def individualPostAsHtml(signingPrivateKeyPem: str,
|
||||||
maxRecentPosts,
|
maxRecentPosts,
|
||||||
signingPrivateKeyPem)
|
signingPrivateKeyPem)
|
||||||
if postHtml:
|
if postHtml:
|
||||||
return postHtml
|
if not _htmlMutedStateChanged(postJsonObject, postHtml):
|
||||||
|
return postHtml
|
||||||
|
|
||||||
announceFilename = \
|
announceFilename = \
|
||||||
locatePost(baseDir, nickname, domain, postJsonObject['id'])
|
locatePost(baseDir, nickname, domain, postJsonObject['id'])
|
||||||
|
|
Loading…
Reference in New Issue