Show number of likes in title

main
Bob Mottram 2020-07-08 18:39:40 +01:00
parent 31e40671a9
commit a5e32811d4
1 changed files with 8 additions and 3 deletions

View File

@ -3816,7 +3816,11 @@ def individualPostAsHtml(recentPostsCache: {}, maxRecentPosts: int,
likeIcon = 'like_inactive.png' likeIcon = 'like_inactive.png'
likeLink = 'like' likeLink = 'like'
likeTitle = translate['Like this post'] likeTitle = translate['Like this post']
if noOfLikes(postJsonObject) > 0: likeCount = noOfLikes(postJsonObject)
likeCountStr = ''
if likeCount > 0:
if likeCount > 1:
likeCountStr = ' (' + str(likeCount) + ')'
likeIcon = 'like.png' likeIcon = 'like.png'
if likedByPerson(postJsonObject, nickname, fullDomain): if likedByPerson(postJsonObject, nickname, fullDomain):
likeLink = 'unlike' likeLink = 'unlike'
@ -3827,9 +3831,10 @@ def individualPostAsHtml(recentPostsCache: {}, maxRecentPosts: int,
pageNumberParam + \ pageNumberParam + \
'?actor=' + postJsonObject['actor'] + \ '?actor=' + postJsonObject['actor'] + \
'?bm=' + timelinePostBookmark + \ '?bm=' + timelinePostBookmark + \
'?tl=' + boxName + '" title="' + likeTitle + '">' '?tl=' + boxName + '" title="' + \
likeTitle + likeCountStr + '">'
likeStr += \ likeStr += \
'<img loading="lazy" title="' + likeTitle + \ '<img loading="lazy" title="' + likeTitle + likeCountStr + \
'" alt="' + likeTitle + \ '" alt="' + likeTitle + \
' |" src="/' + iconsDir + '/' + likeIcon + '"/></a>' ' |" src="/' + iconsDir + '/' + likeIcon + '"/></a>'