diff --git a/posts.py b/posts.py index 530d5005..7f7f19ec 100644 --- a/posts.py +++ b/posts.py @@ -2912,6 +2912,13 @@ def addPostToTimeline(filePath: str, boxname: str, """ with open(filePath, 'r') as postFile: postStr = postFile.read() + + if filePath.endswith('.json'): + repliesFilename = filePath.replace('.json', '.replies') + if os.path.isfile(repliesFilename): + # append a replies identifier, which will later be removed + postStr += '' + return addPostStringToTimeline(postStr, boxname, postsInBox, boxActor) return False @@ -3109,12 +3116,24 @@ def createBoxIndexed(recentPostsCache: {}, return boxHeader for postStr in postsInBox: + # Check if the post has replies + hasReplies = False + if postStr.endswith(''): + hasReplies = True + # remove the replies identifier + postStr = postStr.replace('', '') + p = None try: p = json.loads(postStr) except BaseException: continue + # Does this post have replies? + # This will be used to indicate that replies exist within the html + # created by individualPostAsHtml + p['hasReplies'] = hasReplies + # Don't show likes, replies or shares (announces) to # unauthorized viewers if not authorized: diff --git a/webapp_post.py b/webapp_post.py index b9cb1daf..4e45f0ff 100644 --- a/webapp_post.py +++ b/webapp_post.py @@ -1026,6 +1026,10 @@ def individualPostAsHtml(allowDownloads: bool, publishedStr = datetimeObject.strftime("%a %b %d, %H:%M") else: publishedStr = datetimeObject.strftime("%a %b %d") + # if the post has replies then append a symbol to indicate this + if postJsonObject.get('hasReplies'): + if postJsonObject['hasReplies'] is True: + publishedStr += '↲' # benchmark 15 if not allowDownloads: