Populating posts on profile

master
Bob Mottram 2019-09-02 19:58:20 +01:00
parent 8877202ac1
commit c9f035bb7c
1 changed files with 27 additions and 14 deletions

View File

@ -861,21 +861,34 @@ def htmlProfilePosts(baseDir: str,httpPrefix: str, \
These should only be public posts These should only be public posts
""" """
profileStr='' profileStr=''
maxItems=4
profileStr+='<script>'+contentWarningScript()+'</script>'
ctr=0
currPage=1
while ctr<maxItems and currPage<4:
outboxFeed= \ outboxFeed= \
personBoxJson(baseDir,domain, \ personBoxJson(baseDir,domain, \
port,'/users/'+nickname+'/outbox?page=1', \ port,'/users/'+nickname+'/outbox?page='+str(currPage), \
httpPrefix, \ httpPrefix, \
4, 'outbox', \ 10, 'outbox', \
authorized, \ authorized, \
ocapAlways) ocapAlways)
profileStr+='<script>'+contentWarningScript()+'</script>' if not outboxFeed:
break
if len(outboxFeed['orderedItems'])==0:
break
for item in outboxFeed['orderedItems']: for item in outboxFeed['orderedItems']:
if item['type']=='Create' or item['type']=='Announce': if item['type']=='Create' or item['type']=='Announce':
profileStr+= \ postStr=individualPostAsHtml(baseDir,session,wfRequest,personCache, \
individualPostAsHtml(baseDir,session,wfRequest,personCache, \
nickname,domain,port,item,None,True,False, \ nickname,domain,port,item,None,True,False, \
httpPrefix,projectVersion, \ httpPrefix,projectVersion, \
False,False,False,True) False,False,False,True)
if postStr:
profileStr+=postStr
ctr+=1
if ctr>=maxItems:
break
currPage+=1
return profileStr return profileStr
def htmlProfileFollowing(baseDir: str,httpPrefix: str, \ def htmlProfileFollowing(baseDir: str,httpPrefix: str, \