Show other accounts on search result

merge-requests/30/head
Bob Mottram 2021-01-22 20:48:52 +00:00
parent 67e5cb990a
commit b3549b7729
1 changed files with 24 additions and 2 deletions

View File

@ -229,6 +229,10 @@ def htmlProfileAfterSearch(cssCache: {},
if profileJson['image'].get('url'): if profileJson['image'].get('url'):
imageUrl = profileJson['image']['url'] imageUrl = profileJson['image']['url']
alsoKnownAs = None
if profileJson.get('alsoKnownAs'):
alsoKnownAs = profileJson['alsoKnownAs']
profileStr = \ profileStr = \
_getProfileHeaderAfterSearch(baseDir, _getProfileHeaderAfterSearch(baseDir,
nickname, defaultTimeline, nickname, defaultTimeline,
@ -238,7 +242,7 @@ def htmlProfileAfterSearch(cssCache: {},
displayName, followsYou, displayName, followsYou,
profileDescriptionShort, profileDescriptionShort,
avatarUrl, imageUrl, avatarUrl, imageUrl,
movedTo) movedTo, alsoKnownAs)
domainFull = getFullDomain(domain, port) domainFull = getFullDomain(domain, port)
@ -357,7 +361,8 @@ def _getProfileHeaderAfterSearch(baseDir: str,
followsYou: bool, followsYou: bool,
profileDescriptionShort: str, profileDescriptionShort: str,
avatarUrl: str, imageUrl: str, avatarUrl: str, imageUrl: str,
movedTo: str) -> str: movedTo: str,
alsoKnownAs: []) -> str:
"""The header of a searched for handle, containing background """The header of a searched for handle, containing background
image and avatar image and avatar
""" """
@ -388,6 +393,23 @@ def _getProfileHeaderAfterSearch(baseDir: str,
newHandle = newNickname + '@' + newDomainFull newHandle = newNickname + '@' + newDomainFull
htmlStr += ' <p>' + translate['New account'] + \ htmlStr += ' <p>' + translate['New account'] + \
': < a href="' + movedTo + '">@' + newHandle + '</a></p>\n' ': < a href="' + movedTo + '">@' + newHandle + '</a></p>\n'
elif alsoKnownAs:
htmlStr += \
' <p>' + translate['Other accounts'] + ': '
if isinstance(alsoKnownAs, list):
ctr = 0
for altActor in alsoKnownAs:
if ctr > 0:
htmlStr += ' '
ctr += 1
altDomain, altPort = getDomainFromActor(altActor)
htmlStr += \
'<a href="' + altActor + '">' + altDomain + '</a>'
elif isinstance(alsoKnownAs, str):
altDomain, altPort = getDomainFromActor(alsoKnownAs)
htmlStr += '<a href="' + alsoKnownAs + '">' + altDomain + '</a>'
htmlStr += '</p>\n'
htmlStr += ' <p>' + profileDescriptionShort + '</p>\n' htmlStr += ' <p>' + profileDescriptionShort + '</p>\n'
htmlStr += ' </figcaption>\n' htmlStr += ' </figcaption>\n'