From 5832d93f0a14bcb5bc47bf0cd0439dc4eab259d2 Mon Sep 17 00:00:00 2001 From: Admin Date: Sun, 11 Jan 2026 03:49:30 +0000 Subject: [PATCH] fix: hide Actions/Activity for non-contributors, hide PRs/Projects for non-logged-in users --- templates/repo/header.tmpl | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/templates/repo/header.tmpl b/templates/repo/header.tmpl index d105bcc790..bbb2238402 100644 --- a/templates/repo/header.tmpl +++ b/templates/repo/header.tmpl @@ -155,7 +155,7 @@ {{end}} - {{if and .Repository.CanEnablePulls (.Permission.CanRead ctx.Consts.RepoUnitTypePullRequests)}} + {{if and ctx.IsSigned .Repository.CanEnablePulls (.Permission.CanRead ctx.Consts.RepoUnitTypePullRequests)}} {{svg "octicon-git-pull-request"}} {{ctx.Locale.Tr "repo.pulls"}} {{if .Repository.NumOpenPulls}} @@ -164,7 +164,7 @@ {{end}} - {{if and .EnableActions (.Permission.CanRead ctx.Consts.RepoUnitTypeActions) (not .IsEmptyRepo)}} + {{if and .EnableActions (.Permission.CanWrite ctx.Consts.RepoUnitTypeCode) (not .IsEmptyRepo)}} {{svg "octicon-play"}} {{ctx.Locale.Tr "actions.actions"}} {{if .Repository.NumOpenActionRuns}} @@ -180,7 +180,7 @@ {{end}} {{$projectsUnit := .Repository.MustGetUnit ctx ctx.Consts.RepoUnitTypeProjects}} - {{if and (not ctx.Consts.RepoUnitTypeProjects.UnitGlobalDisabled) (.Permission.CanRead ctx.Consts.RepoUnitTypeProjects) ($projectsUnit.ProjectsConfig.IsProjectsAllowed "repo")}} + {{if and ctx.IsSigned (not ctx.Consts.RepoUnitTypeProjects.UnitGlobalDisabled) (.Permission.CanRead ctx.Consts.RepoUnitTypeProjects) ($projectsUnit.ProjectsConfig.IsProjectsAllowed "repo")}} {{svg "octicon-project"}} {{ctx.Locale.Tr "repo.projects"}} {{if .Repository.NumOpenProjects}} @@ -210,7 +210,7 @@ {{end}} - {{if and (.Permission.CanReadAny ctx.Consts.RepoUnitTypePullRequests ctx.Consts.RepoUnitTypeIssues ctx.Consts.RepoUnitTypeReleases ctx.Consts.RepoUnitTypeCode) (not .IsEmptyRepo)}} + {{if and (.Permission.CanWrite ctx.Consts.RepoUnitTypeCode) (not .IsEmptyRepo)}} {{svg "octicon-pulse"}} {{ctx.Locale.Tr "repo.activity"}}