[v12.0/forgejo] fix(ui): add missing lazy load attribute to images (#8282)

**Backport:** https://codeberg.org/forgejo/forgejo/pulls/8246

closes #8076

Co-authored-by: Bente Groh <mail@bentegroh.de>
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/8282
Reviewed-by: Beowulf <beowulf@beocode.eu>
Co-authored-by: forgejo-backport-action <forgejo-backport-action@noreply.codeberg.org>
Co-committed-by: forgejo-backport-action <forgejo-backport-action@noreply.codeberg.org>
This commit is contained in:
forgejo-backport-action 2025-06-25 20:42:35 +02:00 committed by Beowulf
commit aa648d74ea
10 changed files with 67 additions and 59 deletions

View file

@ -4,7 +4,7 @@
{{if $attachments}}
<div class="card-attachment-images">
{{range $attachments}}
<img src="{{.DownloadURL}}" alt="{{.Name}}" />
<img src="{{.DownloadURL}}" alt="{{.Name}}" loading="lazy"/>
{{end}}
</div>
{{end}}

View file

@ -31,7 +31,7 @@
{{if FilenameIsImage .Name}}
{{if not (StringUtils.Contains (StringUtils.ToString $.RenderedContent) .UUID)}}
<a target="_blank" rel="noopener noreferrer" href="{{.DownloadURL}}">
<img alt="{{.Name}}" src="{{.DownloadURL}}" title="{{ctx.Locale.Tr "repo.issues.attachment.open_tab" .Name}}">
<img alt="{{.Name}}" src="{{.DownloadURL}}" title="{{ctx.Locale.Tr "repo.issues.attachment.open_tab" .Name}}" loading="lazy">
</a>
{{end}}
{{end}}

View file

@ -634,7 +634,7 @@
<div class="timeline-item-group">
<div class="timeline-item event" id="{{.HashTag}}">
<a class="timeline-avatar"{{if gt .Poster.ID 0}} href="{{.Poster.HomeLink}}"{{end}}>
<img src="{{.Poster.AvatarLink $.Context}}" alt="" width="40" height="40">
<img src="{{.Poster.AvatarLink $.Context}}" alt="" width="40" height="40" loading="lazy">
</a>
<span class="badge grey">{{svg "octicon-x" 16}}</span>
<span class="text grey muted-links">

View file

@ -90,7 +90,7 @@
<div class="tw-flex tw-flex-col tw-gap-1">
{{range $push.Commits}}
<div class="flex-text-block">
<img class="ui avatar" src="{{$push.AvatarLink $.Context .AuthorEmail}}" alt="" title="{{.AuthorName}}" width="16" height="16">
<img class="ui avatar" src="{{$push.AvatarLink $.Context .AuthorEmail}}" alt="" title="{{.AuthorName}}" width="16" height="16" loading="lazy">
{{template "repo/shabox" (dict
"sha1" .Sha1
"commitLink" (printf "%s/commit/%s" $repoLink .Sha1)