Button to follow liker

main
Bob Mottram 2020-07-14 10:09:33 +01:00
parent 3333574007
commit 295f2accf8
2 changed files with 24 additions and 2 deletions

View File

@ -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]

View File

@ -4994,10 +4994,32 @@ def htmlIndividualPost(recentPostsCache: {}, maxRecentPosts: int,
if likedByPort:
if likedByPort != 80 and likedByPort != 443:
likedByDomain += ':' + str(likedByPort)
likedByHandle = likedByNickname + '@' + likedByDomain
postStr += \
'<p>' + translate['Liked by'] + \
' <a href="' + likedBy + '">@' + \
likedByNickname + '@' + likedByDomain + '</a></p>\n'
likedByHandle + '</a>'
domainFull = domain
if port:
if port != 80 and port != 443:
domainFull = domain + ':' + str(port)
actor = '/users/' + nickname
followStr = ' <form method="POST" ' + \
'accept-charset="UTF-8" action="' + actor + '/searchhandle">'
followStr += \
' <input type="hidden" name="actor" value="' + actor + '">'
followStr += \
' <input type="hidden" name="searchtext" value="' + \
likedByHandle + '">'
if not isFollowingActor(baseDir, nickname, domainFull, likedBy):
followStr += ' <button type="submit" class="button" ' + \
'name="submitSearch">' + translate['Follow'] + '</button>'
followStr += ' <button type="submit" class="button" ' + \
'name="submitBack">' + translate['Go Back'] + '</button>'
followStr += ' </form>'
postStr += followStr + '</p>\n'
postStr += \
individualPostAsHtml(recentPostsCache, maxRecentPosts,
iconsDir, translate, None,