Show follows you status on profile after search

main
Bob Mottram 2021-01-02 12:00:07 +00:00
parent 03044b9819
commit 0accfaea39
1 changed files with 11 additions and 1 deletions

View File

@ -38,6 +38,7 @@ from tox import getToxAddress
from briar import getBriarAddress from briar import getBriarAddress
from jami import getJamiAddress from jami import getJamiAddress
from filters import isFiltered from filters import isFiltered
from follow import isFollowerOfPerson
from webapp_frontscreen import htmlFrontScreen from webapp_frontscreen import htmlFrontScreen
from webapp_utils import scheduledPostsExist from webapp_utils import scheduledPostsExist
from webapp_utils import getPersonAvatarUrl from webapp_utils import getPersonAvatarUrl
@ -170,6 +171,12 @@ def htmlProfileAfterSearch(cssCache: {},
if lockedAccount: if lockedAccount:
displayName += '🔒' displayName += '🔒'
followsYou = \
isFollowerOfPerson(baseDir,
nickname, domain,
searchNickname,
searchDomainFull)
profileDescription = '' profileDescription = ''
if profileJson.get('summary'): if profileJson.get('summary'):
profileDescription = profileJson['summary'] profileDescription = profileJson['summary']
@ -224,7 +231,7 @@ def htmlProfileAfterSearch(cssCache: {},
searchNickname, searchNickname,
searchDomainFull, searchDomainFull,
translate, translate,
displayName, displayName, followsYou,
profileDescriptionShort, profileDescriptionShort,
avatarUrl, imageUrl) avatarUrl, imageUrl)
@ -330,6 +337,7 @@ def _getProfileHeaderAfterSearch(baseDir: str,
searchDomainFull: str, searchDomainFull: str,
translate: {}, translate: {},
displayName: str, displayName: str,
followsYou: bool,
profileDescriptionShort: str, profileDescriptionShort: str,
avatarUrl: str, imageUrl: str) -> str: avatarUrl: str, imageUrl: str) -> str:
"""The header of a searched for handle, containing background """The header of a searched for handle, containing background
@ -352,6 +360,8 @@ def _getProfileHeaderAfterSearch(baseDir: str,
htmlStr += ' <h1>' + displayName + '</h1>\n' htmlStr += ' <h1>' + displayName + '</h1>\n'
htmlStr += \ htmlStr += \
' <p><b>@' + searchNickname + '@' + searchDomainFull + '</b><br>\n' ' <p><b>@' + searchNickname + '@' + searchDomainFull + '</b><br>\n'
if followsYou:
htmlStr += ' <p><b>' + translate['Follows you'] + '</b></p>\n'
htmlStr += ' <p>' + profileDescriptionShort + '</p>\n' htmlStr += ' <p>' + profileDescriptionShort + '</p>\n'
htmlStr += ' </figcaption>\n' htmlStr += ' </figcaption>\n'
htmlStr += ' </figure>\n\n' htmlStr += ' </figure>\n\n'