From c8de658f77c00677600fbad933e5951b0b377c94 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Fri, 2 Aug 2019 20:47:30 +0100 Subject: [PATCH] Show previous posts in reply sequence --- webinterface.py | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/webinterface.py b/webinterface.py index 5cde5143..b7350a7e 100644 --- a/webinterface.py +++ b/webinterface.py @@ -803,7 +803,22 @@ def htmlIndividualPost(baseDir: str,session,wfRequest: {},personCache: {}, \ postStr= \ individualPostAsHtml(baseDir,session,wfRequest,personCache, \ nickname,domain,port,postJsonObject,None,True,False) - postFilename=locatePost(baseDir,nickname,domain,postJsonObject['id'].replace('/activity','')) + messageId=postJsonObject['id'].replace('/activity','') + + # show the previous posts + while postJsonObject['object'].get('inReplyTo'): + postFilename=locatePost(baseDir,nickname,domain,postJsonObject['object']['inReplyTo']) + if not postFilename: + break + with open(postFilename, 'r') as fp: + postJsonObject=commentjson.load(fp) + postStr= \ + individualPostAsHtml(baseDir,session,wfRequest,personCache, \ + nickname,domain,port,postJsonObject, \ + None,True,False)+postStr + + # show the following posts + postFilename=locatePost(baseDir,nickname,domain,messageId) if postFilename: # is there a replies file for this post? repliesFilename=postFilename.replace('.json','.replies')