Update post cache after regeneration of posts

main
Bob Mottram 2019-11-24 17:40:31 +00:00
parent 40ada98dad
commit 3259190161
5 changed files with 139 additions and 80 deletions

View File

@ -1444,7 +1444,9 @@ class PubServer(BaseHTTPRequestHandler):
self.server.GETbusy=False
return
hashtagStr= \
htmlHashtagSearch(self.server.translate, \
htmlHashtagSearch(self.server.recentPostsCache, \
self.server.maxRecentPosts, \
self.server.translate, \
self.server.baseDir,hashtag,pageNumber, \
maxPostsInFeed,self.server.session, \
self.server.cachedWebfingers, \
@ -1949,7 +1951,9 @@ class PubServer(BaseHTTPRequestHandler):
createSession(self.server.useTor)
deleteStr= \
htmlDeletePost(self.server.translate,pageNumber, \
htmlDeletePost(self.server.recentPostsCache, \
self.server.maxRecentPosts, \
self.server.translate,pageNumber, \
self.server.session,self.server.baseDir, \
deleteUrl,self.server.httpPrefix, \
__version__,self.server.cachedWebfingers, \
@ -2102,7 +2106,9 @@ class PubServer(BaseHTTPRequestHandler):
postJsonObject['likes']={'items': []}
if self._requestHTTP():
msg= \
htmlIndividualPost(self.server.translate, \
htmlIndividualPost(self.server.recentPostsCache, \
self.server.maxRecentPosts, \
self.server.translate, \
self.server.session, \
self.server.cachedWebfingers, \
self.server.personCache, \
@ -2165,7 +2171,9 @@ class PubServer(BaseHTTPRequestHandler):
print('DEBUG: creating new session')
self.server.session= \
createSession(self.server.useTor)
msg=htmlPostReplies(self.server.translate, \
msg=htmlPostReplies(self.server.recentPostsCache, \
self.server.maxRecentPosts, \
self.server.translate, \
self.server.baseDir, \
self.server.session, \
self.server.cachedWebfingers, \
@ -2213,7 +2221,9 @@ class PubServer(BaseHTTPRequestHandler):
print('DEBUG: creating new session')
self.server.session= \
createSession(self.server.useTor)
msg=htmlPostReplies(self.server.translate, \
msg=htmlPostReplies(self.server.recentPostsCache, \
self.server.maxRecentPosts, \
self.server.translate, \
self.server.baseDir, \
self.server.session, \
self.server.cachedWebfingers, \
@ -2256,7 +2266,9 @@ class PubServer(BaseHTTPRequestHandler):
self.path.replace('/roles',''), \
self.server.baseDir)
if getPerson:
msg=htmlProfile(self.server.translate, \
msg=htmlProfile(self.server.recentPostsCache, \
self.server.maxRecentPosts, \
self.server.translate, \
self.server.projectVersion, \
self.server.baseDir, \
self.server.httpPrefix, \
@ -2299,7 +2311,9 @@ class PubServer(BaseHTTPRequestHandler):
self.path.replace('/skills',''), \
self.server.baseDir)
if getPerson:
msg=htmlProfile(self.server.translate, \
msg=htmlProfile(self.server.recentPostsCache, \
self.server.maxRecentPosts, \
self.server.translate, \
self.server.projectVersion, \
self.server.baseDir, \
self.server.httpPrefix, \
@ -2358,7 +2372,9 @@ class PubServer(BaseHTTPRequestHandler):
if postJsonObject.get('likes'):
postJsonObject['likes']={'items': []}
if self._requestHTTP():
msg=htmlIndividualPost(self.server.translate, \
msg=htmlIndividualPost(self.server.recentPostsCache, \
self.server.maxRecentPosts, \
self.server.translate, \
self.server.baseDir, \
self.server.session, \
self.server.cachedWebfingers, \
@ -2425,6 +2441,7 @@ class PubServer(BaseHTTPRequestHandler):
maxPostsInFeed, 'inbox', \
authorized,self.server.ocapAlways)
msg=htmlInbox(self.server.recentPostsCache, \
self.server.maxRecentPosts, \
self.server.translate, \
pageNumber,maxPostsInFeed, \
self.server.session, \
@ -2502,6 +2519,7 @@ class PubServer(BaseHTTPRequestHandler):
maxPostsInFeed, 'dm', \
authorized,self.server.ocapAlways)
msg=htmlInboxDMs(self.server.recentPostsCache, \
self.server.maxRecentPosts, \
self.server.translate, \
pageNumber,maxPostsInFeed, \
self.server.session, \
@ -2580,6 +2598,7 @@ class PubServer(BaseHTTPRequestHandler):
maxPostsInFeed, 'tlreplies', \
True,self.server.ocapAlways)
msg=htmlInboxReplies(self.server.recentPostsCache, \
self.server.maxRecentPosts, \
self.server.translate, \
pageNumber,maxPostsInFeed, \
self.server.session, \
@ -2658,6 +2677,7 @@ class PubServer(BaseHTTPRequestHandler):
maxPostsInMediaFeed, 'tlmedia', \
True,self.server.ocapAlways)
msg=htmlInboxMedia(self.server.recentPostsCache, \
self.server.maxRecentPosts, \
self.server.translate, \
pageNumber,maxPostsInMediaFeed, \
self.server.session, \
@ -2712,6 +2732,7 @@ class PubServer(BaseHTTPRequestHandler):
else:
pageNumber=1
msg=htmlShares(self.server.recentPostsCache, \
self.server.maxRecentPosts, \
self.server.translate, \
pageNumber,maxPostsInFeed, \
self.server.session, \
@ -2774,6 +2795,7 @@ class PubServer(BaseHTTPRequestHandler):
maxPostsInFeed, 'tlbookmarks', \
authorized,self.server.ocapAlways)
msg=htmlBookmarks(self.server.recentPostsCache, \
self.server.maxRecentPosts, \
self.server.translate, \
pageNumber,maxPostsInFeed, \
self.server.session, \
@ -2847,6 +2869,7 @@ class PubServer(BaseHTTPRequestHandler):
authorized, \
self.server.ocapAlways)
msg=htmlOutbox(self.server.recentPostsCache, \
self.server.maxRecentPosts, \
self.server.translate, \
pageNumber,maxPostsInFeed, \
self.server.session, \
@ -2914,6 +2937,7 @@ class PubServer(BaseHTTPRequestHandler):
maxPostsInFeed, 'moderation', \
True,self.server.ocapAlways)
msg=htmlModeration(self.server.recentPostsCache, \
self.server.maxRecentPosts, \
self.server.translate, \
pageNumber,maxPostsInFeed, \
self.server.session, \
@ -2985,7 +3009,9 @@ class PubServer(BaseHTTPRequestHandler):
print('DEBUG: creating new session')
self.server.session= \
createSession(self.server.useTor)
msg=htmlProfile(self.server.translate, \
msg=htmlProfile(self.server.recentPostsCache, \
self.server.maxRecentPosts, \
self.server.translate, \
self.server.projectVersion, \
self.server.baseDir, \
self.server.httpPrefix, \
@ -3042,7 +3068,9 @@ class PubServer(BaseHTTPRequestHandler):
self.server.session= \
createSession(self.server.useTor)
msg=htmlProfile(self.server.translate, \
msg=htmlProfile(self.server.recentPostsCache, \
self.server.maxRecentPosts, \
self.server.translate, \
self.server.projectVersion, \
self.server.baseDir, \
self.server.httpPrefix, \
@ -3100,7 +3128,9 @@ class PubServer(BaseHTTPRequestHandler):
print('DEBUG: creating new session')
self.server.session= \
createSession(self.server.useTor)
msg=htmlProfile(self.server.translate, \
msg=htmlProfile(self.server.recentPostsCache, \
self.server.maxRecentPosts, \
self.server.translate, \
self.server.projectVersion, \
self.server.baseDir, \
self.server.httpPrefix, \
@ -3138,7 +3168,9 @@ class PubServer(BaseHTTPRequestHandler):
print('DEBUG: creating new session')
self.server.session= \
createSession(self.server.useTor)
msg=htmlProfile(self.server.translate, \
msg=htmlProfile(self.server.recentPostsCache, \
self.server.maxRecentPosts, \
self.server.translate, \
self.server.projectVersion, \
self.server.baseDir, \
self.server.httpPrefix, \
@ -4229,7 +4261,9 @@ class PubServer(BaseHTTPRequestHandler):
if searchStr.startswith('#'):
# hashtag search
hashtagStr= \
htmlHashtagSearch(self.server.translate, \
htmlHashtagSearch(self.server.recentPostsCache, \
self.server.maxRecentPosts, \
self.server.translate, \
self.server.baseDir,searchStr[1:],1, \
maxPostsInFeed,self.server.session, \
self.server.cachedWebfingers, \
@ -4263,7 +4297,9 @@ class PubServer(BaseHTTPRequestHandler):
self.server.session= \
createSession(self.server.useTor)
profileStr= \
htmlProfileAfterSearch(self.server.translate, \
htmlProfileAfterSearch(self.server.recentPostsCache, \
self.server.maxRecentPosts, \
self.server.translate, \
self.server.baseDir, \
self.path.replace('/searchhandle',''), \
self.server.httpPrefix, \

View File

@ -55,29 +55,6 @@ from posts import sendSignedJson
from webinterface import individualPostAsHtml
from webinterface import getIconsDir
def updateRecentPostsCache(recentPostsCache: {},maxRecentPosts: int, \
postJsonObject: {},htmlStr: str) -> None:
"""Store recent posts in memory so that they can be quickly recalled
"""
if not postJsonObject.get('id'):
return
postId=postJsonObject['id'].replace('/activity','').replace('/','#')
if recentPostsCache.get('index'):
recentPostsCache['index'].append(postId)
recentPostsCache['json'][postId]=json.dumps(postJsonObject)
recentPostsCache['html'][postId]=htmlStr
while len(recentPostsCache['html'].items())>maxRecentPosts:
recentPostsCache['index'].pop(0)
del recentPostsCache['json'][postId]
del recentPostsCache['html'][postId]
else:
recentPostsCache['index']=[postId]
recentPostsCache['json']={}
recentPostsCache['html']={}
recentPostsCache['json'][postId]=json.dumps(postJsonObject)
recentPostsCache['html'][postId]=htmlStr
def inboxStorePostToHtmlCache(recentPostsCache: {},maxRecentPosts: int, \
translate: {}, \
baseDir: str,httpPrefix: str, \
@ -93,15 +70,14 @@ def inboxStorePostToHtmlCache(recentPostsCache: {},maxRecentPosts: int, \
avatarUrl=None
boxName='inbox'
htmlStr= \
individualPostAsHtml(getIconsDir(baseDir),translate,pageNumber, \
individualPostAsHtml(recentPostsCache,maxRecentPosts, \
getIconsDir(baseDir),translate,pageNumber, \
baseDir,session,cachedWebfingers,personCache, \
nickname,domain,port,postJsonObject, \
avatarUrl,True,allowDeletion, \
httpPrefix,__version__,boxName, \
not isDM(postJsonObject), \
True,True,False,True)
updateRecentPostsCache(recentPostsCache,maxRecentPosts, \
postJsonObject,htmlStr)
def validInbox(baseDir: str,nickname: str,domain: str) -> bool:
"""Checks whether files were correctly saved to the inbox

View File

@ -36,6 +36,7 @@ from follow import clearFollows
from follow import clearFollowers
from follow import sendFollowRequestViaServer
from follow import sendUnfollowRequestViaServer
from utils import updateRecentPostsCache
from utils import followPerson
from utils import getNicknameFromActor
from utils import getDomainFromActor
@ -67,7 +68,6 @@ from media import getAttachmentMediaType
from delete import sendDeleteViaServer
from inbox import validInbox
from inbox import validInboxFilenames
from inbox import updateRecentPostsCache
from content import addWebLinks
from content import replaceEmojiFromTags
from content import addHtmlTags

View File

@ -468,3 +468,28 @@ def removePostFromCache(postJsonObject: {},recentPostsCache: {}):
del recentPostsCache['json'][postId]
del recentPostsCache['html'][postId]
recentPostsCache['index'].remove(postId)
def updateRecentPostsCache(recentPostsCache: {},maxRecentPosts: int, \
postJsonObject: {},htmlStr: str) -> None:
"""Store recent posts in memory so that they can be quickly recalled
"""
if not postJsonObject.get('id'):
return
postId=postJsonObject['id'].replace('/activity','').replace('/','#')
if recentPostsCache.get('index'):
if postId in recentPostsCache['index']:
return
recentPostsCache['index'].append(postId)
recentPostsCache['json'][postId]=json.dumps(postJsonObject)
recentPostsCache['html'][postId]=htmlStr
while len(recentPostsCache['html'].items())>maxRecentPosts:
recentPostsCache['index'].pop(0)
del recentPostsCache['json'][postId]
del recentPostsCache['html'][postId]
else:
recentPostsCache['index']=[postId]
recentPostsCache['json']={}
recentPostsCache['html']={}
recentPostsCache['json'][postId]=json.dumps(postJsonObject)
recentPostsCache['html'][postId]=htmlStr

View File

@ -19,6 +19,7 @@ from pprint import pprint
from person import personBoxJson
from person import isPersonSnoozed
from donate import getDonationUrl
from utils import updateRecentPostsCache
from utils import getNicknameFromActor
from utils import getDomainFromActor
from utils import locatePost
@ -336,7 +337,8 @@ def htmlModerationInfo(translate: {},baseDir: str) -> str:
infoForm+=htmlFooter()
return infoForm
def htmlHashtagSearch(translate: {}, \
def htmlHashtagSearch(recentPostsCache: {},maxRecentPosts: int, \
translate: {}, \
baseDir: str,hashtag: str,pageNumber: int,postsPerPage: int, \
session,wfRequest: {},personCache: {}, \
httpPrefix: str,projectVersion: str) -> str:
@ -391,7 +393,8 @@ def htmlHashtagSearch(translate: {}, \
index-=1
continue
hashtagSearchForm+= \
individualPostAsHtml(iconsDir,translate,None, \
individualPostAsHtml(recentPostsCache,maxRecentPosts, \
iconsDir,translate,None, \
baseDir,session,wfRequest,personCache, \
nickname,domain,port,postJsonObject, \
None,True,False, \
@ -1113,7 +1116,8 @@ def htmlFooter() -> str:
htmlStr+='</html>\n'
return htmlStr
def htmlProfilePosts(translate: {}, \
def htmlProfilePosts(recentPostsCache: {},maxRecentPosts: int, \
translate: {}, \
baseDir: str,httpPrefix: str, \
authorized: bool,ocapAlways: bool, \
nickname: str,domain: str,port: int, \
@ -1142,11 +1146,13 @@ def htmlProfilePosts(translate: {}, \
break
for item in outboxFeed['orderedItems']:
if item['type']=='Create':
postStr=individualPostAsHtml(iconsDir,translate,None, \
baseDir,session,wfRequest,personCache, \
nickname,domain,port,item,None,True,False, \
httpPrefix,projectVersion,'inbox', \
False,False,False,True,False)
postStr= \
individualPostAsHtml(recentPostsCache,maxRecentPosts, \
iconsDir,translate,None, \
baseDir,session,wfRequest,personCache, \
nickname,domain,port,item,None,True,False, \
httpPrefix,projectVersion,'inbox', \
False,False,False,True,False)
if postStr:
profileStr+=postStr
ctr+=1
@ -1328,7 +1334,8 @@ def htmlSharesTimeline(translate: {},pageNumber: int,itemsPerPage: int, \
return timelineStr
def htmlProfile(translate: {},projectVersion: str, \
def htmlProfile(recentPostsCache: {},maxRecentPosts: int, \
translate: {},projectVersion: str, \
baseDir: str,httpPrefix: str,authorized: bool, \
ocapAlways: bool,profileJson: {},selected: str, \
session,wfRequest: {},personCache: {}, \
@ -1478,7 +1485,8 @@ def htmlProfile(translate: {},projectVersion: str, \
if selected=='posts':
profileStr+= \
htmlProfilePosts(translate, \
htmlProfilePosts(recentPostsCache,maxRecentPosts, \
translate, \
baseDir,httpPrefix,authorized, \
ocapAlways,nickname,domain,port, \
session,wfRequest,personCache, \
@ -1883,7 +1891,8 @@ def preparePostFromHtmlCache(postHtml: str,boxName: str,pageNumber: int) -> str:
postHtml=postHtml.replace('?tl=inbox','?tl=tlbookmarks')
return postHtml.replace(';-999;',';'+str(pageNumber)+';').replace('?page=-999','?page='+str(pageNumber))
def individualPostAsHtml(iconsDir: str,translate: {}, \
def individualPostAsHtml(recentPostsCache: {},maxRecentPosts: int, \
iconsDir: str,translate: {}, \
pageNumber: int,baseDir: str, \
session,wfRequest: {},personCache: {}, \
nickname: str,domain: str,port: int, \
@ -2353,6 +2362,8 @@ def individualPostAsHtml(iconsDir: str,translate: {}, \
boxName!='tlmedia'and boxName!='tlbookmarks':
saveIndividualPostAsHtmlToCache(baseDir,nickname,domain, \
postJsonObject,postHtml)
updateRecentPostsCache(recentPostsCache,maxRecentPosts, \
postJsonObject,postHtml)
return postHtml
@ -2368,7 +2379,7 @@ def isQuestion(postObjectJson: {}) -> bool:
return True
return False
def htmlTimeline(recentPostsCache: {}, \
def htmlTimeline(recentPostsCache: {},maxRecentPosts: int,
translate: {},pageNumber: int, \
itemsPerPage: int,session,baseDir: str, \
wfRequest: {},personCache: {}, \
@ -2591,7 +2602,8 @@ def htmlTimeline(recentPostsCache: {}, \
#print('Post obtained from recent cache ('+str(len(recentPostsCache['index']))+'): '+postId)
if not currTlStr:
currTlStr= \
individualPostAsHtml(iconsDir,translate,pageNumber, \
individualPostAsHtml(recentPostsCache,maxRecentPosts, \
iconsDir,translate,pageNumber, \
baseDir,session,wfRequest,personCache, \
nickname,domain,port,item,None,True, \
allowDeletion, \
@ -2612,7 +2624,7 @@ def htmlTimeline(recentPostsCache: {}, \
tlStr+=htmlFooter()
return tlStr
def htmlShares(recentPostsCache: {}, \
def htmlShares(recentPostsCache: {},maxRecentPosts: int, \
translate: {},pageNumber: int,itemsPerPage: int, \
session,baseDir: str,wfRequest: {},personCache: {}, \
nickname: str,domain: str,port: int, \
@ -2623,13 +2635,13 @@ def htmlShares(recentPostsCache: {}, \
manuallyApproveFollowers= \
followerApprovalActive(baseDir,nickname,domain)
return htmlTimeline(recentPostsCache, \
return htmlTimeline(recentPostsCache,maxRecentPosts, \
translate,pageNumber, \
itemsPerPage,session,baseDir,wfRequest,personCache, \
nickname,domain,port,None,'tlshares',allowDeletion, \
httpPrefix,projectVersion,manuallyApproveFollowers)
def htmlInbox(recentPostsCache: {}, \
def htmlInbox(recentPostsCache: {},maxRecentPosts: int, \
translate: {},pageNumber: int,itemsPerPage: int, \
session,baseDir: str,wfRequest: {},personCache: {}, \
nickname: str,domain: str,port: int,inboxJson: {}, \
@ -2640,13 +2652,13 @@ def htmlInbox(recentPostsCache: {}, \
manuallyApproveFollowers= \
followerApprovalActive(baseDir,nickname,domain)
return htmlTimeline(recentPostsCache, \
return htmlTimeline(recentPostsCache,maxRecentPosts, \
translate,pageNumber, \
itemsPerPage,session,baseDir,wfRequest,personCache, \
nickname,domain,port,inboxJson,'inbox',allowDeletion, \
httpPrefix,projectVersion,manuallyApproveFollowers)
def htmlBookmarks(recentPostsCache: {}, \
def htmlBookmarks(recentPostsCache: {},maxRecentPosts: int, \
translate: {},pageNumber: int,itemsPerPage: int, \
session,baseDir: str,wfRequest: {},personCache: {}, \
nickname: str,domain: str,port: int,bookmarksJson: {}, \
@ -2657,13 +2669,13 @@ def htmlBookmarks(recentPostsCache: {}, \
manuallyApproveFollowers= \
followerApprovalActive(baseDir,nickname,domain)
return htmlTimeline(recentPostsCache, \
return htmlTimeline(recentPostsCache,maxRecentPosts, \
translate,pageNumber, \
itemsPerPage,session,baseDir,wfRequest,personCache, \
nickname,domain,port,bookmarksJson,'tlbookmarks',allowDeletion, \
httpPrefix,projectVersion,manuallyApproveFollowers)
def htmlInboxDMs(recentPostsCache: {}, \
def htmlInboxDMs(recentPostsCache: {},maxRecentPosts: int, \
translate: {},pageNumber: int,itemsPerPage: int, \
session,baseDir: str,wfRequest: {},personCache: {}, \
nickname: str,domain: str,port: int,inboxJson: {}, \
@ -2671,13 +2683,13 @@ def htmlInboxDMs(recentPostsCache: {}, \
httpPrefix: str,projectVersion: str) -> str:
"""Show the DM timeline as html
"""
return htmlTimeline(recentPostsCache, \
return htmlTimeline(recentPostsCache,maxRecentPosts, \
translate,pageNumber, \
itemsPerPage,session,baseDir,wfRequest,personCache, \
nickname,domain,port,inboxJson,'dm',allowDeletion, \
httpPrefix,projectVersion,False)
def htmlInboxReplies(recentPostsCache: {}, \
def htmlInboxReplies(recentPostsCache: {},maxRecentPosts: int, \
translate: {},pageNumber: int,itemsPerPage: int, \
session,baseDir: str,wfRequest: {},personCache: {}, \
nickname: str,domain: str,port: int,inboxJson: {}, \
@ -2685,13 +2697,13 @@ def htmlInboxReplies(recentPostsCache: {}, \
httpPrefix: str,projectVersion: str) -> str:
"""Show the replies timeline as html
"""
return htmlTimeline(recentPostsCache, \
return htmlTimeline(recentPostsCache,maxRecentPosts, \
translate,pageNumber, \
itemsPerPage,session,baseDir,wfRequest,personCache, \
nickname,domain,port,inboxJson,'tlreplies',allowDeletion, \
httpPrefix,projectVersion,False)
def htmlInboxMedia(recentPostsCache: {}, \
def htmlInboxMedia(recentPostsCache: {},maxRecentPosts: int, \
translate: {},pageNumber: int,itemsPerPage: int, \
session,baseDir: str,wfRequest: {},personCache: {}, \
nickname: str,domain: str,port: int,inboxJson: {}, \
@ -2699,13 +2711,13 @@ def htmlInboxMedia(recentPostsCache: {}, \
httpPrefix: str,projectVersion: str) -> str:
"""Show the media timeline as html
"""
return htmlTimeline(recentPostsCache, \
return htmlTimeline(recentPostsCache,maxRecentPosts, \
translate,pageNumber, \
itemsPerPage,session,baseDir,wfRequest,personCache, \
nickname,domain,port,inboxJson,'tlmedia',allowDeletion, \
httpPrefix,projectVersion,False)
def htmlModeration(recentPostsCache: {}, \
def htmlModeration(recentPostsCache: {},maxRecentPosts: int, \
translate: {},pageNumber: int,itemsPerPage: int, \
session,baseDir: str,wfRequest: {},personCache: {}, \
nickname: str,domain: str,port: int,inboxJson: {}, \
@ -2713,13 +2725,13 @@ def htmlModeration(recentPostsCache: {}, \
httpPrefix: str,projectVersion: str) -> str:
"""Show the moderation feed as html
"""
return htmlTimeline(recentPostsCache, \
return htmlTimeline(recentPostsCache,maxRecentPosts, \
translate,pageNumber, \
itemsPerPage,session,baseDir,wfRequest,personCache, \
nickname,domain,port,inboxJson,'moderation',allowDeletion, \
httpPrefix,projectVersion,True)
def htmlOutbox(recentPostsCache: {}, \
def htmlOutbox(recentPostsCache: {},maxRecentPosts: int, \
translate: {},pageNumber: int,itemsPerPage: int, \
session,baseDir: str,wfRequest: {},personCache: {}, \
nickname: str,domain: str,port: int,outboxJson: {}, \
@ -2729,13 +2741,14 @@ def htmlOutbox(recentPostsCache: {}, \
"""
manuallyApproveFollowers= \
followerApprovalActive(baseDir,nickname,domain)
return htmlTimeline(recentPostsCache, \
return htmlTimeline(recentPostsCache,maxRecentPosts, \
translate,pageNumber, \
itemsPerPage,session,baseDir,wfRequest,personCache, \
nickname,domain,port,outboxJson,'outbox',allowDeletion, \
httpPrefix,projectVersion,manuallyApproveFollowers)
def htmlIndividualPost(translate: {}, \
def htmlIndividualPost(recentPostsCache: {},maxRecentPosts: int, \
translate: {}, \
baseDir: str,session,wfRequest: {},personCache: {}, \
nickname: str,domain: str,port: int,authorized: bool, \
postJsonObject: {},httpPrefix: str,projectVersion: str) -> str:
@ -2744,7 +2757,8 @@ def htmlIndividualPost(translate: {}, \
iconsDir=getIconsDir(baseDir)
postStr='<script>'+contentWarningScript()+'</script>'
postStr+= \
individualPostAsHtml(iconsDir,translate,None, \
individualPostAsHtml(recentPostsCache,maxRecentPosts, \
iconsDir,translate,None, \
baseDir,session,wfRequest,personCache, \
nickname,domain,port,postJsonObject,None,True,False, \
httpPrefix,projectVersion,'inbox', \
@ -2759,7 +2773,8 @@ def htmlIndividualPost(translate: {}, \
postJsonObject=loadJson(postFilename)
if postJsonObject:
postStr= \
individualPostAsHtml(iconsDir,translate,None, \
individualPostAsHtml(recentPostsCache,maxRecentPosts, \
iconsDir,translate,None, \
baseDir,session,wfRequest,personCache, \
nickname,domain,port,postJsonObject, \
None,True,False, \
@ -2778,7 +2793,8 @@ def htmlIndividualPost(translate: {}, \
# add items to the html output
for item in repliesJson['orderedItems']:
postStr+= \
individualPostAsHtml(iconsDir,translate,None, \
individualPostAsHtml(recentPostsCache,maxRecentPosts, \
iconsDir,translate,None, \
baseDir,session,wfRequest,personCache, \
nickname,domain,port,item,None,True,False, \
httpPrefix,projectVersion,'inbox', \
@ -2790,7 +2806,8 @@ def htmlIndividualPost(translate: {}, \
postsCSS=cssFile.read()
return htmlHeader(cssFilename,postsCSS)+postStr+htmlFooter()
def htmlPostReplies(translate: {},baseDir: str, \
def htmlPostReplies(recentPostsCache: {},maxRecentPosts: int, \
translate: {},baseDir: str, \
session,wfRequest: {},personCache: {}, \
nickname: str,domain: str,port: int,repliesJson: {}, \
httpPrefix: str,projectVersion: str) -> str:
@ -2801,7 +2818,8 @@ def htmlPostReplies(translate: {},baseDir: str, \
if repliesJson.get('orderedItems'):
for item in repliesJson['orderedItems']:
repliesStr+= \
individualPostAsHtml(iconsDir,translate,None, \
individualPostAsHtml(recentPostsCache,maxRecentPosts, \
iconsDir,translate,None, \
baseDir,session,wfRequest,personCache, \
nickname,domain,port,item,None,True,False, \
httpPrefix,projectVersion,'inbox', \
@ -2864,7 +2882,8 @@ def htmlRemoveSharedItem(translate: {},baseDir: str,actor: str,shareName: str) -
sharesStr+=htmlFooter()
return sharesStr
def htmlDeletePost(translate,pageNumber: int, \
def htmlDeletePost(recentPostsCache: {},maxRecentPosts: int, \
translate,pageNumber: int, \
session,baseDir: str,messageId: str, \
httpPrefix: str,projectVersion: str, \
wfRequest: {},personCache: {}) -> str:
@ -2899,7 +2918,8 @@ def htmlDeletePost(translate,pageNumber: int, \
deletePostStr=htmlHeader(cssFilename,profileStyle)
deletePostStr+='<script>'+contentWarningScript()+'</script>'
deletePostStr+= \
individualPostAsHtml(iconsDir,translate,pageNumber, \
individualPostAsHtml(recentPostsCache,maxRecentPosts, \
iconsDir,translate,pageNumber, \
baseDir,session,wfRequest,personCache, \
nickname,domain,port,postJsonObject, \
None,True,False, \
@ -3472,7 +3492,8 @@ def htmlSearch(translate: {}, \
followStr+=htmlFooter()
return followStr
def htmlProfileAfterSearch(translate: {}, \
def htmlProfileAfterSearch(recentPostsCache: {},maxRecentPosts: int, \
translate: {}, \
baseDir: str,path: str,httpPrefix: str, \
nickname: str,domain: str,port: int, \
profileHandle: str, \
@ -3626,7 +3647,8 @@ def htmlProfileAfterSearch(translate: {}, \
if not item.get('object'):
continue
profileStr+= \
individualPostAsHtml(iconsDir,translate,None,baseDir, \
individualPostAsHtml(recentPostsCache,maxRecentPosts, \
iconsDir,translate,None,baseDir, \
session,wfRequest,personCache, \
nickname,domain,port, \
item,avatarUrl,False,False, \