diff --git a/webapp_person_options.py b/webapp_person_options.py index 69153af86..cbf9049d9 100644 --- a/webapp_person_options.py +++ b/webapp_person_options.py @@ -145,23 +145,30 @@ def htmlPersonOptions(defaultTimeline: str, translate['New account'] + \ ': @' + newHandle + '

\n' elif alsoKnownAs: - optionsStr += \ + otherAccountsHtml = \ '

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

\n' + if alsoKnownAs != optionsActor: + ctr += 1 + altDomain, altPort = getDomainFromActor(alsoKnownAs) + otherAccountsHtml += \ + '' + altDomain + '' + otherAccountsHtml += '

\n' + if ctr > 0: + optionsStr += otherAccountsHtml if emailAddress: optionsStr += \ '

' + translate['Email'] + \ diff --git a/webapp_profile.py b/webapp_profile.py index 2fa59c458..244b39650 100644 --- a/webapp_profile.py +++ b/webapp_profile.py @@ -242,7 +242,8 @@ def htmlProfileAfterSearch(cssCache: {}, displayName, followsYou, profileDescriptionShort, avatarUrl, imageUrl, - movedTo, alsoKnownAs) + movedTo, profileJson['id'], + alsoKnownAs) domainFull = getFullDomain(domain, port) @@ -303,7 +304,8 @@ def htmlProfileAfterSearch(cssCache: {}, profileStr + htmlFooter() -def _getProfileHeader(baseDir: str, nickname: str, domain: str, +def _getProfileHeader(baseDir: str, httpPrefix: str, + nickname: str, domain: str, domainFull: str, translate: {}, defaultTimeline: str, displayName: str, @@ -341,22 +343,30 @@ def _getProfileHeader(baseDir: str, nickname: str, domain: str, '@' + \ newNickname + '@' + newDomainFull + '
\n' elif alsoKnownAs: - htmlStr += \ + otherAccountsHtml = \ '

' + translate['Other accounts'] + ': ' + actor = httpPrefix + '://' + domainFull + '/users/' + nickname + ctr = 0 if isinstance(alsoKnownAs, list): - ctr = 0 for altActor in alsoKnownAs: + if altActor == actor: + continue if ctr > 0: - htmlStr += ' ' + otherAccountsHtml += ' ' ctr += 1 altDomain, altPort = getDomainFromActor(altActor) - htmlStr += \ + otherAccountsHtml += \ '' + altDomain + '' elif isinstance(alsoKnownAs, str): - altDomain, altPort = getDomainFromActor(alsoKnownAs) - htmlStr += '' + altDomain + '' - htmlStr += '

\n' + if alsoKnownAs != actor: + ctr += 1 + altDomain, altPort = getDomainFromActor(alsoKnownAs) + otherAccountsHtml += \ + '' + altDomain + '' + otherAccountsHtml += '

\n' + if ctr > 0: + htmlStr += otherAccountsHtml htmlStr += \ ' @' + newHandle + '

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

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

\n' + if alsoKnownAs != actor: + ctr += 1 + altDomain, altPort = getDomainFromActor(alsoKnownAs) + otherAccountshtml += \ + '' + altDomain + '' + + otherAccountshtml += '

\n' + if ctr > 0: + htmlStr += otherAccountshtml htmlStr += '

' + profileDescriptionShort + '

\n' htmlStr += ' \n' @@ -662,7 +680,8 @@ def htmlProfile(rssIconAtTop: bool, avatarUrl = profileJson['icon']['url'] profileHeaderStr = \ - _getProfileHeader(baseDir, nickname, domain, + _getProfileHeader(baseDir, httpPrefix, + nickname, domain, domainFull, translate, defaultTimeline, displayName, avatarDescription,