Broken link substitute for reply image in post

merge-requests/8/head
Bob Mottram 2020-12-06 15:35:49 +00:00
parent 5c6a45956c
commit 2887fb2661
1 changed files with 12 additions and 3 deletions

View File

@ -772,6 +772,10 @@ def getPostTitleAnnounceHtml(baseDir: str,
if announceAvatarUrl: if announceAvatarUrl:
idx = 'Show options for this person' idx = 'Show options for this person'
if '/users/news/' not in announceAvatarUrl: if '/users/news/' not in announceAvatarUrl:
brokenLinkSubstitute = \
" onerror=\"this.onerror=null; this.src='" + \
iconsPath + "/avatar_default.png'\""
replyAvatarImageInPost = \ replyAvatarImageInPost = \
' ' \ ' ' \
'<div class=' + \ '<div class=' + \
@ -785,9 +789,10 @@ def getPostTitleAnnounceHtml(baseDir: str,
';' + announceAvatarUrl + \ ';' + announceAvatarUrl + \
messageIdStr + '">' \ messageIdStr + '">' \
'<img loading="lazy" src="' + \ '<img loading="lazy" src="' + \
announceAvatarUrl + '" ' \ announceAvatarUrl + '" ' + \
'title="' + translate[idx] + \ 'title="' + translate[idx] + \
'" alt=" "' + avatarPosition + \ '" alt=" "' + avatarPosition + \
brokenLinkSubstitute + \
'/></a>\n </div>\n' '/></a>\n </div>\n'
else: else:
titleStr += \ titleStr += \
@ -959,6 +964,10 @@ def getPostTitleReplyHtml(baseDir: str,
logPostTiming(enableTimingLog, postStartTime, '13.8') logPostTiming(enableTimingLog, postStartTime, '13.8')
if replyAvatarUrl: if replyAvatarUrl:
brokenLinkSubstitute = \
" onerror=\"this.onerror=null; this.src='" + \
iconsPath + "/avatar_default.png'\""
replyAvatarImageInPost = \ replyAvatarImageInPost = \
' <div class=' + \ ' <div class=' + \
'"timeline-avatar-reply">\n' '"timeline-avatar-reply">\n'
@ -979,8 +988,8 @@ def getPostTitleReplyHtml(baseDir: str,
translate['Show profile'] translate['Show profile']
replyAvatarImageInPost += \ replyAvatarImageInPost += \
'" alt=" "' + \ '" alt=" "' + \
avatarPosition + '/></a>\n' + \ avatarPosition + brokenLinkSubstitute + \
' </div>\n' '/></a>\n </div>\n'
else: else:
inReplyTo = \ inReplyTo = \
postJsonObject['object']['inReplyTo'] postJsonObject['object']['inReplyTo']