From b3549b77292f12da492e75f22dfcc9f5d848abf6 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Fri, 22 Jan 2021 20:48:52 +0000 Subject: [PATCH] Show other accounts on search result --- webapp_profile.py | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/webapp_profile.py b/webapp_profile.py index 31c3b32c4..ab2af2084 100644 --- a/webapp_profile.py +++ b/webapp_profile.py @@ -229,6 +229,10 @@ def htmlProfileAfterSearch(cssCache: {}, if profileJson['image'].get('url'): imageUrl = profileJson['image']['url'] + alsoKnownAs = None + if profileJson.get('alsoKnownAs'): + alsoKnownAs = profileJson['alsoKnownAs'] + profileStr = \ _getProfileHeaderAfterSearch(baseDir, nickname, defaultTimeline, @@ -238,7 +242,7 @@ def htmlProfileAfterSearch(cssCache: {}, displayName, followsYou, profileDescriptionShort, avatarUrl, imageUrl, - movedTo) + movedTo, alsoKnownAs) domainFull = getFullDomain(domain, port) @@ -357,7 +361,8 @@ def _getProfileHeaderAfterSearch(baseDir: str, followsYou: bool, profileDescriptionShort: str, avatarUrl: str, imageUrl: str, - movedTo: str) -> str: + movedTo: str, + alsoKnownAs: []) -> str: """The header of a searched for handle, containing background image and avatar """ @@ -388,6 +393,23 @@ def _getProfileHeaderAfterSearch(baseDir: str, newHandle = newNickname + '@' + newDomainFull htmlStr += '

' + translate['New account'] + \ ': < a href="' + movedTo + '">@' + newHandle + '

\n' + elif alsoKnownAs: + htmlStr += \ + '

' + translate['Other accounts'] + ': ' + + if isinstance(alsoKnownAs, list): + ctr = 0 + for altActor in alsoKnownAs: + if ctr > 0: + htmlStr += ' ' + ctr += 1 + altDomain, altPort = getDomainFromActor(altActor) + htmlStr += \ + '' + altDomain + '' + elif isinstance(alsoKnownAs, str): + altDomain, altPort = getDomainFromActor(alsoKnownAs) + htmlStr += '' + altDomain + '' + htmlStr += '

\n' htmlStr += '

' + profileDescriptionShort + '

\n' htmlStr += ' \n'