From 34140b6ee90a28e4e735cf3a394bdbe2bcfae834 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Fri, 18 Oct 2019 13:00:14 +0100 Subject: [PATCH] Tidyin --- webinterface.py | 36 ++++++++++++++++++++++-------------- 1 file changed, 22 insertions(+), 14 deletions(-) diff --git a/webinterface.py b/webinterface.py index f35afede..dbe96436 100644 --- a/webinterface.py +++ b/webinterface.py @@ -1702,6 +1702,26 @@ def addEmojiToDisplayName(baseDir: str,httpPrefix: str, \ print('TAG: displayName after tag replacements: '+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: {}, \ pageNumber: int,baseDir: str, \ session,wfRequest: {},personCache: {}, \ @@ -1741,20 +1761,8 @@ def individualPostAsHtml(iconsDir: str,translate: {}, \ # if this post should be public then check its recipients if showPublicOnly: - if postJsonObject['object'].get('to'): - containsPublic=False - 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 '' + if not postContainsPublic(postJsonObject): + return '' isModerationPost=False if postJsonObject['object'].get('moderationStatus'):