mirror of https://gitlab.com/bashrc2/epicyon
Show total moderator votes on newswire items
parent
20d3a93be8
commit
adc6cd9317
|
@ -79,7 +79,7 @@ def xml2StrToDict(xmlStr: str) -> {}:
|
|||
try:
|
||||
publishedDate = \
|
||||
datetime.strptime(pubDate, "%a, %d %b %Y %H:%M:%S %z")
|
||||
result[str(publishedDate)] = [title, link, ['votes:0']]
|
||||
result[str(publishedDate)] = [title, link, []]
|
||||
parsed = True
|
||||
except BaseException:
|
||||
pass
|
||||
|
@ -232,8 +232,7 @@ def addAccountBlogsToNewswire(baseDir: str, nickname: str, domain: str,
|
|||
published = published.replace('Z', '+00:00')
|
||||
newswire[published] = \
|
||||
[postJsonObject['object']['summary'],
|
||||
postJsonObject['object']['url'],
|
||||
['votes:0']]
|
||||
postJsonObject['object']['url'], []]
|
||||
|
||||
ctr += 1
|
||||
if ctr >= maxBlogsPerAccount:
|
||||
|
|
|
@ -5347,8 +5347,19 @@ def htmlNewswire(newswire: str, nickname: str, moderator: bool) -> str:
|
|||
dateStrLink = dateStr.replace(' ', 'T')
|
||||
dateStrLink = dateStrLink.replace('+00:00', '')
|
||||
if 'vote:' + nickname in item[2]:
|
||||
totalVotesStr = ''
|
||||
if moderator:
|
||||
# count the total votes for this item
|
||||
totalVotes = 0
|
||||
for line in item[2]:
|
||||
if '[vote:' in line:
|
||||
totalVotes += 1
|
||||
if totalVotes > 0:
|
||||
totalVotesStr = ' +' + str(totalVotes)
|
||||
|
||||
htmlStr += '<p class="newswireItemApproved">' + \
|
||||
'<a href="' + item[1] + '">' + item[0] + '</a>'
|
||||
'<a href="' + item[1] + '">' + item[0] + '</a>' + \
|
||||
totalVotesStr
|
||||
if moderator:
|
||||
htmlStr += \
|
||||
' ' + \
|
||||
|
@ -5360,8 +5371,19 @@ def htmlNewswire(newswire: str, nickname: str, moderator: bool) -> str:
|
|||
htmlStr += ' <label class="newswireDateApproved">'
|
||||
htmlStr += dateStr.replace('+00:00', '') + '</label></p>'
|
||||
else:
|
||||
totalVotesStr = ''
|
||||
if moderator:
|
||||
# count the total votes for this item
|
||||
totalVotes = 0
|
||||
for line in item[2]:
|
||||
if '[vote:' in line:
|
||||
totalVotes += 1
|
||||
if totalVotes > 0:
|
||||
totalVotesStr = ' +' + str(totalVotes)
|
||||
|
||||
htmlStr += '<p class="newswireItem">' + \
|
||||
'<a href="' + item[1] + '">' + item[0] + '</a>'
|
||||
'<a href="' + item[1] + '">' + item[0] + '</a>' + \
|
||||
totalVotesStr
|
||||
if moderator:
|
||||
htmlStr += \
|
||||
' ' + \
|
||||
|
|
Loading…
Reference in New Issue