From 666f23ba1d6a5d6ef91c22364f954744316ed915 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Fri, 28 Feb 2020 20:50:56 +0000 Subject: [PATCH] Count number of tags --- delete.py | 3 ++- webinterface.py | 24 +++++++++++++++++++----- 2 files changed, 21 insertions(+), 6 deletions(-) diff --git a/delete.py b/delete.py index a38c50538..627f7c88d 100644 --- a/delete.py +++ b/delete.py @@ -197,7 +197,8 @@ def deletePostPub(session,baseDir: str,federationList: [], \ if ':' not in deletedDomain: deletedDomain=deletedDomain+':'+str(deletePort) - objectUrl = deleteHttpsPrefix + '://'+deletedDomain+'/users/'+ \ + objectUrl = \ + deleteHttpsPrefix + '://'+deletedDomain+'/users/'+ \ deleteNickname+'/statuses/'+str(deleteStatusNumber) return deletePublic(session,baseDir,federationList, \ diff --git a/webinterface.py b/webinterface.py index bbf45a14e..773562678 100644 --- a/webinterface.py +++ b/webinterface.py @@ -4797,6 +4797,7 @@ def htmlHashTagSwarm(baseDir: str,actor: str) -> str: daysSinceEpochStr=str(daysSinceEpoch)+' ' nickname=getNicknameFromActor(actor) tagSwarm=[] + tagSwarmCtr=[] for subdir, dirs, files in os.walk(baseDir+'/tags'): for f in files: tagsFilename=os.path.join(baseDir+'/tags',f) @@ -4807,6 +4808,7 @@ def htmlHashTagSwarm(baseDir: str,actor: str) -> str: continue if daysSinceEpochStr not in open(tagsFilename).read(): continue + tagCtr=0 with open(tagsFilename, 'r') as tagsFile: lines=tagsFile.readlines() for l in lines: @@ -4819,16 +4821,28 @@ def htmlHashTagSwarm(baseDir: str,actor: str) -> str: if postDaysSinceEpoch3: + break + if tagCtr>0: + tagSwarmCtr.append(tagCtr) if not tagSwarm: return '' tagSwarm.sort() tagSwarmStr='' + ctr=0 for tagName in tagSwarm: - tagSwarmStr+= \ - ''+tagName+' ' + if tagSwarmCtr[ctr]<2: + tagSwarmStr+= \ + ''+tagName+' ' + else: + tagSwarmStr+= \ + ''+tagName+' ' + ctr+=1 tagSwarmHtml=tagSwarmStr.strip()+'\n' return tagSwarmHtml