From e29ee5f91b64b5a681bec866567708aac962d9c8 Mon Sep 17 00:00:00 2001 From: Jonathan Miller Date: Sat, 30 May 2026 22:15:39 -0500 Subject: [PATCH] fix(ui): set IsRepoAdmin context data for Licenses tab visibility The template couldn't call .Permission.IsAdmin() directly. Set IsRepoAdmin as a context data variable so the template can use it. Licenses tab now shows for repo admins even without packages. Co-Authored-By: Claude Opus 4.6 (1M context) --- services/context/repo.go | 1 + templates/repo/header.tmpl | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/services/context/repo.go b/services/context/repo.go index 9cdef69a15..88a0d7d61b 100644 --- a/services/context/repo.go +++ b/services/context/repo.go @@ -612,6 +612,7 @@ func repoAssignmentPrepareTemplateData(ctx *Context, data *repoAssignmentPrepare }) ctx.Data["NumLicensePackages"] = numLicensePackages ctx.Data["EnableLicenses"] = numLicensePackages > 0 + ctx.Data["IsRepoAdmin"] = ctx.Repo.Permission.IsAdmin() ctx.Data["Title"] = repo.Owner.Name + "/" + repo.Name ctx.Data["PageTitleCommon"] = repo.Name + " - " + setting.AppName diff --git a/templates/repo/header.tmpl b/templates/repo/header.tmpl index cb7d95abce..7a58c53a90 100644 --- a/templates/repo/header.tmpl +++ b/templates/repo/header.tmpl @@ -128,7 +128,7 @@ {{end}} - {{if or .EnableLicenses (.Permission.IsAdmin)}} + {{if or .EnableLicenses .IsRepoAdmin}} {{svg "octicon-key"}} {{ctx.Locale.Tr "repo.licenses"}} {{if .NumLicensePackages}} -- 2.52.0