From 11ed040990949d8fe0a4a787672cbd63ce96e82c Mon Sep 17 00:00:00 2001 From: silverwind Date: Fri, 28 Nov 2025 18:27:27 +0100 Subject: [PATCH] fixes --- routers/web/repo/view.go | 1 + templates/repo/header.tmpl | 2 +- templates/repo/icon.tmpl | 8 ++++++-- templates/shared/repo/list.tmpl | 2 +- 4 files changed, 9 insertions(+), 4 deletions(-) diff --git a/routers/web/repo/view.go b/routers/web/repo/view.go index cfd256855e..09ac33cff4 100644 --- a/routers/web/repo/view.go +++ b/routers/web/repo/view.go @@ -412,6 +412,7 @@ func Forks(ctx *context.Context) { } pager := context.NewPagination(int(total), pageSize, page, 5) + ctx.Data["ShowRepoOwnerAvatar"] = true ctx.Data["ShowRepoOwnerOnList"] = true ctx.Data["Page"] = pager ctx.Data["Repos"] = forks diff --git a/templates/repo/header.tmpl b/templates/repo/header.tmpl index 0fe24564d3..8a96af117b 100644 --- a/templates/repo/header.tmpl +++ b/templates/repo/header.tmpl @@ -4,7 +4,7 @@
- {{template "repo/icon" (dict "Repo" . "EnableRepoAvatar" "true" "Size" 24)}} + {{template "repo/icon" (dict "Repo" . "Size" 24 "ShowRepoAvatar" true)}}
diff --git a/templates/repo/icon.tmpl b/templates/repo/icon.tmpl index 0411bc84e4..f7dd4e5b50 100644 --- a/templates/repo/icon.tmpl +++ b/templates/repo/icon.tmpl @@ -1,13 +1,17 @@ {{/* Template Attributes: * Repo: The repo -* EnableRepoAvatar: Enable repo avatars when non-nil +* ShowRepoAvatar: Enable repo avatar when `true` +* ShowRepoOwnerAvatar: Enable owner avatars when `true` * Size: Icon size in pixels, default is 16 * * Note: Keep the icon logic in sync with web_src/js/utils/mappings.ts */}} {{$size := or .Size 16}} {{$avatarLink := (.Repo.RelAvatarLink ctx)}} -{{if and $avatarLink .EnableRepoAvatar}} + +{{if .ShowRepoOwnerAvatar}} + {{ctx.AvatarUtils.Avatar .Repo.Owner 24}} +{{else if and $avatarLink .ShowRepoAvatar}} {{else if .Repo.IsMirror}} {{svg "octicon-mirror" $size}} diff --git a/templates/shared/repo/list.tmpl b/templates/shared/repo/list.tmpl index 6bcd0a4d8d..7f30805e88 100644 --- a/templates/shared/repo/list.tmpl +++ b/templates/shared/repo/list.tmpl @@ -2,7 +2,7 @@ {{range .Repos}}
- {{template "repo/icon" (dict "Repo" . "Size" 24 "EnableRepoAvatar" "true")}} + {{template "repo/icon" (dict "Repo" . "Size" 24 "ShowRepoOwnerAvatar" $.ShowRepoOwnerAvatar)}}