Hide the "Details" link of commit status when the user cannot access actions (followup)

commit.Status may be nil
This commit is contained in:
Earl Warren 2024-08-04 09:30:36 +02:00
parent c8e5e39865
commit 170c1c5152
No known key found for this signature in database
GPG key ID: 0579CB2928A78A00
2 changed files with 6 additions and 0 deletions

View file

@ -463,6 +463,9 @@ func processGitCommits(ctx *context.Context, gitCommits []*git.Commit) []*git_mo
commits := git_model.ConvertFromGitCommit(ctx, gitCommits, ctx.Repo.Repository) commits := git_model.ConvertFromGitCommit(ctx, gitCommits, ctx.Repo.Repository)
if !ctx.Repo.CanRead(unit_model.TypeActions) { if !ctx.Repo.CanRead(unit_model.TypeActions) {
for _, commit := range commits { for _, commit := range commits {
if commit.Status == nil {
continue
}
commit.Status.HideActionsURL(ctx) commit.Status.HideActionsURL(ctx)
git_model.CommitStatusesHideActionsURL(ctx, commit.Statuses) git_model.CommitStatusesHideActionsURL(ctx, commit.Statuses)
} }

View file

@ -1784,6 +1784,9 @@ func ViewIssue(ctx *context.Context) {
} }
if !ctx.Repo.CanRead(unit.TypeActions) { if !ctx.Repo.CanRead(unit.TypeActions) {
for _, commit := range comment.Commits { for _, commit := range comment.Commits {
if commit.Status == nil {
continue
}
commit.Status.HideActionsURL(ctx) commit.Status.HideActionsURL(ctx)
git_model.CommitStatusesHideActionsURL(ctx, commit.Statuses) git_model.CommitStatusesHideActionsURL(ctx, commit.Statuses)
} }