From 295f2accf827729f6d3fad51ae17741ce798e5e3 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Tue, 14 Jul 2020 10:09:33 +0100 Subject: [PATCH] Button to follow liker --- follow.py | 2 +- webinterface.py | 24 +++++++++++++++++++++++- 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/follow.py b/follow.py index b3963654..a66cadf1 100644 --- a/follow.py +++ b/follow.py @@ -84,7 +84,7 @@ def removeFromFollowRejects(baseDir: str, def isFollowingActor(baseDir: str, nickname: str, domain: str, actor: str) -> bool: - """Is the given actor a follower of the given nickname? + """Is the given nickname following the given actor? """ if ':' in domain: domain = domain.split(':')[0] diff --git a/webinterface.py b/webinterface.py index 2453e50c..8099bc33 100644 --- a/webinterface.py +++ b/webinterface.py @@ -4994,10 +4994,32 @@ def htmlIndividualPost(recentPostsCache: {}, maxRecentPosts: int, if likedByPort: if likedByPort != 80 and likedByPort != 443: likedByDomain += ':' + str(likedByPort) + likedByHandle = likedByNickname + '@' + likedByDomain postStr += \ '

' + translate['Liked by'] + \ ' @' + \ - likedByNickname + '@' + likedByDomain + '

\n' + likedByHandle + '' + + domainFull = domain + if port: + if port != 80 and port != 443: + domainFull = domain + ':' + str(port) + actor = '/users/' + nickname + followStr = '
' + followStr += \ + ' ' + followStr += \ + ' ' + if not isFollowingActor(baseDir, nickname, domainFull, likedBy): + followStr += ' ' + followStr += ' ' + followStr += '
' + postStr += followStr + '

\n' + postStr += \ individualPostAsHtml(recentPostsCache, maxRecentPosts, iconsDir, translate, None,