mirror of
https://github.com/go-gitea/gitea.git
synced 2026-08-21 21:30:36 +00:00
fix: resolve actions commit status permission per repository (#38977)
Various pages did not display the correct action run list tooltips. Fix those tooltips like here on the `/pulls` page: `ctx.Repo.Permission` is the zero value outside a repository route, so on `/pulls`, `/issues`, `/notifications/subscriptions` and the dashboard repo list the commit status "Details" link was always stripped. The live job status is looked up from that target URL, so running checks also rendered as a static pending dot instead of a spinner. Resolve the Actions unit permission per repository instead. Also drops the releases page's gate on *loading* statuses, which hid external CI results from anyone without Actions read; it now loads them and hides only the URL, like every other page. Co-authored-by: bircni <bircni@icloud.com>
This commit is contained in:
@@ -17,7 +17,6 @@ import (
|
||||
issues_model "gitea.dev/models/issues"
|
||||
"gitea.dev/models/renderhelper"
|
||||
repo_model "gitea.dev/models/repo"
|
||||
unit_model "gitea.dev/models/unit"
|
||||
user_model "gitea.dev/models/user"
|
||||
"gitea.dev/modules/base"
|
||||
"gitea.dev/modules/fileicon"
|
||||
@@ -388,9 +387,7 @@ func Diff(ctx *context.Context) {
|
||||
if err != nil {
|
||||
log.Error("GetLatestCommitStatus: %v", err)
|
||||
}
|
||||
if !ctx.Repo.Permission.CanRead(unit_model.TypeActions) {
|
||||
git_model.CommitStatusesHideActionsURL(ctx, statuses)
|
||||
}
|
||||
git_model.CommitStatusesApplyDoerPermission(ctx, ctx.Doer, statuses)
|
||||
|
||||
ctx.Data["CommitStatus"] = git_model.CalcCommitStatus(statuses)
|
||||
ctx.Data["CommitStatuses"] = statuses
|
||||
@@ -466,14 +463,6 @@ func processGitCommits(ctx *context.Context, gitCommits []*git.Commit) ([]*git_m
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if !ctx.Repo.Permission.CanRead(unit_model.TypeActions) {
|
||||
for _, commit := range commits {
|
||||
if commit.Status == nil {
|
||||
continue
|
||||
}
|
||||
commit.Status.HideActionsURL(ctx)
|
||||
git_model.CommitStatusesHideActionsURL(ctx, commit.Statuses)
|
||||
}
|
||||
}
|
||||
git_model.SignCommitsApplyDoerPermission(ctx, ctx.Doer, commits)
|
||||
return commits, nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user