Show avatar background after search

merge-requests/8/head
Bob Mottram 2020-11-12 23:44:16 +00:00
parent a4aa41c315
commit f8885e26b7
1 changed files with 9 additions and 4 deletions

View File

@ -209,13 +209,18 @@ def htmlProfileAfterSearch(cssCache: {},
if '<' in avatarDescription: if '<' in avatarDescription:
avatarDescription = removeHtml(avatarDescription) avatarDescription = removeHtml(avatarDescription)
imageUrl = ''
if profileJson.get('image'):
if profileJson['image'].get('url'):
imageUrl = profileJson['image']['url']
profileStr = \ profileStr = \
getProfileHeaderAfterSearch(baseDir, searchNickname, getProfileHeaderAfterSearch(baseDir, searchNickname,
searchDomainFull, searchDomainFull,
translate, translate,
displayName, displayName,
profileDescriptionShort, profileDescriptionShort,
avatarUrl) avatarUrl, imageUrl)
profileStr += '<div class="container">\n' profileStr += '<div class="container">\n'
profileStr += ' <form method="POST" action="' + \ profileStr += ' <form method="POST" action="' + \
@ -308,13 +313,13 @@ def getProfileHeaderAfterSearch(baseDir: str, searchNickname: str,
translate: {}, translate: {},
displayName: str, displayName: str,
profileDescriptionShort: str, profileDescriptionShort: str,
avatarUrl: 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
image and avatar image and avatar
""" """
htmlStr = '\n\n <figure class="profileHeader">\n' htmlStr = '\n\n <figure class="profileHeader">\n'
# htmlStr += ' <img class="profileBackground" ' + \ htmlStr += ' <img class="profileBackground" ' + \
# 'src="/users/' + nickname + '/image.png" /></a>\n' 'src="' + imageUrl + '" /></a>\n'
htmlStr += ' <figcaption>\n' htmlStr += ' <figcaption>\n'
if avatarUrl: if avatarUrl:
htmlStr += \ htmlStr += \