From 12150b752f36770e020663a6fcf6fc3552e32987 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Wed, 10 Jul 2019 18:03:51 +0100 Subject: [PATCH] Include shared inbox in person inbox GET --- posts.py | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/posts.py b/posts.py index 05fe0822..7cb84550 100644 --- a/posts.py +++ b/posts.py @@ -774,6 +774,9 @@ def createBoxBase(baseDir: str,boxname: str, \ if boxname!='inbox' and boxname!='outbox': return None boxDir = createPersonDir(nickname,domain,baseDir,boxname) + sharedBoxDir=None + if boxname=='inbox': + sharedBoxDir = createPersonDir('inbox',domain,baseDir,boxname) if port!=80 and port!=443: domain = domain+':'+str(port) @@ -801,7 +804,16 @@ def createBoxBase(baseDir: str,boxname: str, \ postsOnPageCtr=0 # post filenames sorted in descending order - postsInBox=sorted(os.listdir(boxDir), reverse=True) + postsInBox=[] + postsInPersonInbox=sorted(os.listdir(boxDir), reverse=True) + for postFilename in postsInPersonInbox: + postsInBox.append(os.path.join(boxDir, postFilename)) + + # combine the inbox for the account with the shared inbox + if sharedBoxDir: + postsInSharedInbox=sorted(os.listdir(sharedBoxDir), reverse=True) + for postFilename in postsInSharedInbox: + postsInBox.append(os.path.join(sharedBoxDir, postFilename)) # number of posts in box boxHeader['totalItems']=len(postsInBox) @@ -830,7 +842,7 @@ def createBoxBase(baseDir: str,boxname: str, \ httpPrefix+'://'+domain+'/users/'+nickname+'/'+ \ boxname+'?min_id='+postId+'&page=true' # get the full path of the post file - filePath = os.path.join(boxDir, postFilename) + filePath = postFilename try: if os.path.isfile(filePath): if currPage == pageNumber and postsOnPageCtr <= itemsPerPage: