Avoid repeated posts in timeline

main2
Bob Mottram 2019-09-30 16:52:37 +01:00
parent 58961cc5e1
commit f23d5f7c6a
1 changed files with 17 additions and 12 deletions

View File

@ -1644,7 +1644,8 @@ def individualPostAsHtml(iconsDir: str,translate: {}, \
galleryStr='' galleryStr=''
isAnnounced=False isAnnounced=False
if postJsonObject['type']=='Announce': if postJsonObject['type']=='Announce':
postJsonAnnounce=downloadAnnounce(session,baseDir,httpPrefix,nickname,domain,postJsonObject,projectVersion) postJsonAnnounce= \
downloadAnnounce(session,baseDir,httpPrefix,nickname,domain,postJsonObject,projectVersion)
if not postJsonAnnounce: if not postJsonAnnounce:
return '' return ''
postJsonObject=postJsonAnnounce postJsonObject=postJsonAnnounce
@ -1796,8 +1797,7 @@ def individualPostAsHtml(iconsDir: str,translate: {}, \
'<div class="gallery">\n' \ '<div class="gallery">\n' \
' <a href="'+messageId+'">\n' \ ' <a href="'+messageId+'">\n' \
' <img src="'+attach['url']+'" alt="'+imageDescription+'" title="'+imageDescription+'" width="600" height="400">\n' \ ' <img src="'+attach['url']+'" alt="'+imageDescription+'" title="'+imageDescription+'" width="600" height="400">\n' \
' </a>\n' ' </a>\n</div>\n'
galleryStr+='</div>\n'
attachmentStr+= \ attachmentStr+= \
'<a href="'+attach['url']+'">' \ '<a href="'+attach['url']+'">' \
'<img src="'+attach['url']+'" alt="'+imageDescription+'" title="'+imageDescription+'" class="attachment"></a>\n' '<img src="'+attach['url']+'" alt="'+imageDescription+'" title="'+imageDescription+'" class="attachment"></a>\n'
@ -2126,19 +2126,24 @@ def htmlTimeline(translate: {},pageNumber: int, \
if pageNumber>1: if pageNumber>1:
tlStr+='<br>' tlStr+='<br>'
tlStr+='<div class="galleryContainer">\n' tlStr+='<div class="galleryContainer">\n'
prevStr=''
for item in timelineJson['orderedItems']: for item in timelineJson['orderedItems']:
if item['type']=='Create' or item['type']=='Announce': if item['type']=='Create' or item['type']=='Announce':
itemCtr+=1 itemCtr+=1
avatarUrl=getPersonAvatarUrl(baseDir,item['actor'],personCache) avatarUrl=getPersonAvatarUrl(baseDir,item['actor'],personCache)
tlStr+= \ currTlStr= \
individualPostAsHtml(iconsDir,translate,pageNumber, \ individualPostAsHtml(iconsDir,translate,pageNumber, \
baseDir,session,wfRequest,personCache, \ baseDir,session,wfRequest,personCache, \
nickname,domain,port,item,avatarUrl,True, \ nickname,domain,port,item,avatarUrl,True, \
allowDeletion, \ allowDeletion, \
httpPrefix,projectVersion,boxName, \ httpPrefix,projectVersion,boxName, \
boxName!='dm', \ boxName!='dm', \
showIndividualPostIcons, \ showIndividualPostIcons, \
manuallyApproveFollowers,False) manuallyApproveFollowers,False)
# avoid repeated posts
if currTlStr!=prevStr:
tlStr+=currTlStr
prevStr=currTlStr
if boxName=='tlmedia': if boxName=='tlmedia':
tlStr+='</div>\n' tlStr+='</div>\n'