main2
Bob Mottram 2019-10-18 13:00:14 +01:00
parent 9b60370a5a
commit 34140b6ee9
1 changed files with 22 additions and 14 deletions

View File

@ -1702,6 +1702,26 @@ def addEmojiToDisplayName(baseDir: str,httpPrefix: str, \
print('TAG: displayName after tag replacements: '+displayName) print('TAG: displayName after tag replacements: '+displayName)
return displayName return displayName
def postContainsPublic(postJsonObject: {}) -> bool:
"""Does the given post contain #Public
"""
containsPublic=False
if not postJsonObject['object'].get('to'):
return containsPublic
for toAddress in postJsonObject['object']['to']:
if toAddress.endswith('#Public'):
containsPublic=True
break
if not containsPublic:
if postJsonObject['object'].get('cc'):
for toAddress in postJsonObject['object']['cc']:
if toAddress.endswith('#Public'):
containsPublic=True
break
return containsPublic
def individualPostAsHtml(iconsDir: str,translate: {}, \ def individualPostAsHtml(iconsDir: str,translate: {}, \
pageNumber: int,baseDir: str, \ pageNumber: int,baseDir: str, \
session,wfRequest: {},personCache: {}, \ session,wfRequest: {},personCache: {}, \
@ -1741,20 +1761,8 @@ def individualPostAsHtml(iconsDir: str,translate: {}, \
# if this post should be public then check its recipients # if this post should be public then check its recipients
if showPublicOnly: if showPublicOnly:
if postJsonObject['object'].get('to'): if not postContainsPublic(postJsonObject):
containsPublic=False return ''
for toAddress in postJsonObject['object']['to']:
if toAddress.endswith('#Public'):
containsPublic=True
break
if not containsPublic:
if postJsonObject['object'].get('cc'):
for toAddress in postJsonObject['object']['cc']:
if toAddress.endswith('#Public'):
containsPublic=True
break
if not containsPublic:
return ''
isModerationPost=False isModerationPost=False
if postJsonObject['object'].get('moderationStatus'): if postJsonObject['object'].get('moderationStatus'):