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

Fix #26685

If a commit status comes from Gitea Actions and the user cannot access
the repo's actions unit (the user does not have the permission or the
actions unit is disabled), a 404 page will occur after clicking the
"Details" link. We should hide the "Details" link in this case.

<img
src="68361714-b784-4bb5-baab-efde4221f466"
width="400px" />

(cherry picked from commit 7dec8de9147b20c014d68bb1020afe28a263b95a)

Conflicts:
	routers/web/repo/commit.go
  trivial context commit
This commit is contained in:
Zettat123 2024-07-28 23:11:40 +08:00 committed by Earl Warren
parent f17194ca91
commit 0dbc623028
No known key found for this signature in database
GPG key ID: 0579CB2928A78A00
11 changed files with 131 additions and 6 deletions

View file

@ -643,7 +643,7 @@ func PrepareCompareDiff(
return false
}
commits := git_model.ConvertFromGitCommit(ctx, ci.CompareInfo.Commits, ci.HeadRepo)
commits := processGitCommits(ctx, ci.CompareInfo.Commits)
ctx.Data["Commits"] = commits
ctx.Data["CommitCount"] = len(commits)