Show moved to address in profile header

merge-requests/30/head
Bob Mottram 2021-01-12 13:18:08 +00:00
parent 482f179f25
commit b756203651
2 changed files with 34 additions and 5 deletions

View File

@ -142,7 +142,7 @@ def htmlPersonOptions(defaultTimeline: str,
optionsStr += \ optionsStr += \
' <p class="optionsText">' + \ ' <p class="optionsText">' + \
translate['New account'] + \ translate['New account'] + \
': <a href="' + movedTo + '">' + newHandle + '</a></p>\n' ': <a href="' + movedTo + '">@' + newHandle + '</a></p>\n'
if emailAddress: if emailAddress:
optionsStr += \ optionsStr += \
'<p class="imText">' + translate['Email'] + \ '<p class="imText">' + translate['Email'] + \

View File

@ -170,6 +170,10 @@ def htmlProfileAfterSearch(cssCache: {},
lockedAccount = getLockedAccount(profileJson) lockedAccount = getLockedAccount(profileJson)
if lockedAccount: if lockedAccount:
displayName += '🔒' displayName += '🔒'
movedTo = ''
if profileJson.get('movedTo'):
movedTo = profileJson['movedTo']
displayName += ''
followsYou = \ followsYou = \
isFollowerOfPerson(baseDir, isFollowerOfPerson(baseDir,
@ -233,7 +237,8 @@ def htmlProfileAfterSearch(cssCache: {},
translate, translate,
displayName, followsYou, displayName, followsYou,
profileDescriptionShort, profileDescriptionShort,
avatarUrl, imageUrl) avatarUrl, imageUrl,
movedTo)
domainFull = getFullDomain(domain, port) domainFull = getFullDomain(domain, port)
@ -301,7 +306,7 @@ def _getProfileHeader(baseDir: str, nickname: str, domain: str,
avatarDescription: str, avatarDescription: str,
profileDescriptionShort: str, profileDescriptionShort: str,
loginButton: str, avatarUrl: str, loginButton: str, avatarUrl: str,
theme: str) -> str: theme: str, movedTo: str) -> str:
"""The header of the profile screen, containing background """The header of the profile screen, containing background
image and avatar image and avatar
""" """
@ -321,6 +326,15 @@ def _getProfileHeader(baseDir: str, nickname: str, domain: str,
htmlStr += ' <h1>' + displayName + '</h1>\n' htmlStr += ' <h1>' + displayName + '</h1>\n'
htmlStr += \ htmlStr += \
' <p><b>@' + nickname + '@' + domainFull + '</b><br>\n' ' <p><b>@' + nickname + '@' + domainFull + '</b><br>\n'
if movedTo:
newNickname = getNicknameFromActor(movedTo)
newDomain, newPort = getDomainFromActor(movedTo)
newDomainFull = getFullDomain(newDomain, newPort)
if newNickname and newDomain:
htmlStr += \
' <p>' + translate['New account'] + ': ' + \
'<a href="' + movedTo + '">@' + \
newNickname + '@' + newDomainFull + '</a><br>\n'
htmlStr += \ htmlStr += \
' <a href="/users/' + nickname + \ ' <a href="/users/' + nickname + \
'/qrcode.png" alt="' + translate['QR Code'] + '" title="' + \ '/qrcode.png" alt="' + translate['QR Code'] + '" title="' + \
@ -342,7 +356,8 @@ def _getProfileHeaderAfterSearch(baseDir: str,
displayName: str, displayName: str,
followsYou: bool, followsYou: bool,
profileDescriptionShort: str, profileDescriptionShort: str,
avatarUrl: str, imageUrl: str) -> str: avatarUrl: str, imageUrl: str,
movedTo: str) -> 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
""" """
@ -365,6 +380,15 @@ def _getProfileHeaderAfterSearch(baseDir: str,
' <p><b>@' + searchNickname + '@' + searchDomainFull + '</b><br>\n' ' <p><b>@' + searchNickname + '@' + searchDomainFull + '</b><br>\n'
if followsYou: if followsYou:
htmlStr += ' <p><b>' + translate['Follows you'] + '</b></p>\n' htmlStr += ' <p><b>' + translate['Follows you'] + '</b></p>\n'
if movedTo:
newNickname = getNicknameFromActor(movedTo)
newDomain, newPort = getDomainFromActor(movedTo)
newDomainFull = getFullDomain(newDomain, newPort)
if newNickname and newDomain:
newHandle = newNickname + '@' + newDomainFull
htmlStr += ' <p>' + translate['New account'] + \
': < a href="' + movedTo + '">@' + newHandle + '</a></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'
@ -588,6 +612,10 @@ def htmlProfile(rssIconAtTop: bool,
avatarDescription = avatarDescription.replace('<p>', '') avatarDescription = avatarDescription.replace('<p>', '')
avatarDescription = avatarDescription.replace('</p>', '') avatarDescription = avatarDescription.replace('</p>', '')
movedTo = ''
if profileJson.get('movedTo'):
movedTo = profileJson['movedTo']
avatarUrl = profileJson['icon']['url'] avatarUrl = profileJson['icon']['url']
profileHeaderStr = \ profileHeaderStr = \
_getProfileHeader(baseDir, nickname, domain, _getProfileHeader(baseDir, nickname, domain,
@ -595,7 +623,8 @@ def htmlProfile(rssIconAtTop: bool,
defaultTimeline, displayName, defaultTimeline, displayName,
avatarDescription, avatarDescription,
profileDescriptionShort, profileDescriptionShort,
loginButton, avatarUrl, theme) loginButton, avatarUrl, theme,
movedTo)
profileStr = profileHeaderStr + donateSection profileStr = profileHeaderStr + donateSection
profileStr += '<div class="container" id="buttonheader">\n' profileStr += '<div class="container" id="buttonheader">\n'