Substitute broken avatars on person options screen

merge-requests/8/head
Bob Mottram 2020-12-12 10:38:48 +00:00
parent e996141fd8
commit 98fdf7d1f2
3 changed files with 11 additions and 9 deletions

View File

@ -18,6 +18,7 @@ from follow import isFollowingActor
from followingCalendar import receivingCalendarEvents
from webapp_utils import htmlHeaderWithExternalStyle
from webapp_utils import htmlFooter
from webapp_utils import getBrokenLinkSubstitute
def htmlPersonOptions(defaultTimeline: str,
@ -103,7 +104,7 @@ def htmlPersonOptions(defaultTimeline: str,
optionsStr += ' <center>\n'
optionsStr += ' <a href="' + optionsActor + '">\n'
optionsStr += ' <img loading="lazy" src="' + optionsProfileUrl + \
'"/></a>\n'
'" ' + getBrokenLinkSubstitute() + '/></a>\n'
handle = getNicknameFromActor(optionsActor) + '@' + optionsDomain
optionsStr += \
' <p class="optionsText">' + translate['Options for'] + \

View File

@ -55,6 +55,7 @@ from webapp_utils import getContentWarningButton
from webapp_utils import getPostAttachmentsAsHtml
from webapp_utils import htmlHeaderWithExternalStyle
from webapp_utils import htmlFooter
from webapp_utils import getBrokenLinkSubstitute
from webapp_media import addEmbeddedElements
from webapp_question import insertQuestion
from devices import E2EEdecryptMessageFromDevice
@ -201,14 +202,6 @@ def getAvatarImageUrl(session,
return avatarUrl
def getBrokenLinkSubstitute() -> str:
"""Returns html used to show a default image if the link to
an image is broken
"""
return " onerror=\"this.onerror=null; this.src='" + \
"/icons/avatar_default.png'\""
def getAvatarImageHtml(showAvatarOptions: bool,
nickname: str, domainFull: str,
avatarUrl: str, postActor: str,

View File

@ -20,6 +20,14 @@ from content import addHtmlTags
from content import replaceEmojiFromTags
def getBrokenLinkSubstitute() -> str:
"""Returns html used to show a default image if the link to
an image is broken
"""
return " onerror=\"this.onerror=null; this.src='" + \
"/icons/avatar_default.png'\""
def htmlFollowingList(cssCache: {}, baseDir: str,
followingFilename: str) -> str:
"""Returns a list of handles being followed