Include shared inbox in person inbox GET

master
Bob Mottram 2019-07-10 18:03:51 +01:00
parent dec94017ef
commit 12150b752f
1 changed files with 14 additions and 2 deletions

View File

@ -774,6 +774,9 @@ def createBoxBase(baseDir: str,boxname: str, \
if boxname!='inbox' and boxname!='outbox': if boxname!='inbox' and boxname!='outbox':
return None return None
boxDir = createPersonDir(nickname,domain,baseDir,boxname) boxDir = createPersonDir(nickname,domain,baseDir,boxname)
sharedBoxDir=None
if boxname=='inbox':
sharedBoxDir = createPersonDir('inbox',domain,baseDir,boxname)
if port!=80 and port!=443: if port!=80 and port!=443:
domain = domain+':'+str(port) domain = domain+':'+str(port)
@ -801,7 +804,16 @@ def createBoxBase(baseDir: str,boxname: str, \
postsOnPageCtr=0 postsOnPageCtr=0
# post filenames sorted in descending order # 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 # number of posts in box
boxHeader['totalItems']=len(postsInBox) boxHeader['totalItems']=len(postsInBox)
@ -830,7 +842,7 @@ def createBoxBase(baseDir: str,boxname: str, \
httpPrefix+'://'+domain+'/users/'+nickname+'/'+ \ httpPrefix+'://'+domain+'/users/'+nickname+'/'+ \
boxname+'?min_id='+postId+'&page=true' boxname+'?min_id='+postId+'&page=true'
# get the full path of the post file # get the full path of the post file
filePath = os.path.join(boxDir, postFilename) filePath = postFilename
try: try:
if os.path.isfile(filePath): if os.path.isfile(filePath):
if currPage == pageNumber and postsOnPageCtr <= itemsPerPage: if currPage == pageNumber and postsOnPageCtr <= itemsPerPage: