@ -16,6 +16,7 @@ import (
"code.gitea.io/gitea/models/db"
git_model "code.gitea.io/gitea/models/git"
repo_model "code.gitea.io/gitea/models/repo"
unit_model "code.gitea.io/gitea/models/unit"
user_model "code.gitea.io/gitea/models/user"
"code.gitea.io/gitea/modules/base"
"code.gitea.io/gitea/modules/charset"
@ -81,7 +82,7 @@ func Commits(ctx *context.Context) {
ctx . ServerError ( "CommitsByRange" , err )
return
}
ctx . Data [ "Commits" ] = git_model . ConvertFromGitCommit ( ctx , commits , ctx . Repo . Repository )
ctx . Data [ "Commits" ] = processGitCommits ( ctx , commits )
ctx . Data [ "Username" ] = ctx . Repo . Owner . Name
ctx . Data [ "Reponame" ] = ctx . Repo . Repository . Name
@ -199,7 +200,7 @@ func SearchCommits(ctx *context.Context) {
return
}
ctx . Data [ "CommitCount" ] = len ( commits )
ctx . Data [ "Commits" ] = git_model . ConvertFromGitCommit ( ctx , commits , ctx . Repo . Repository )
ctx . Data [ "Commits" ] = processGitCommits ( ctx , commits )
ctx . Data [ "Keyword" ] = query
if all {
@ -242,7 +243,7 @@ func FileHistory(ctx *context.Context) {
ctx . ServerError ( "CommitsByFileAndRange" , err )
return
}
ctx . Data [ "Commits" ] = git_model . ConvertFromGitCommit ( ctx , commits , ctx . Repo . Repository )
ctx . Data [ "Commits" ] = processGitCommits ( ctx , commits )
ctx . Data [ "Username" ] = ctx . Repo . Owner . Name
ctx . Data [ "Reponame" ] = ctx . Repo . Repository . Name
@ -353,6 +354,9 @@ func Diff(ctx *context.Context) {
if err != nil {
log . Error ( "GetLatestCommitStatus: %v" , err )
}
if ! ctx . Repo . CanRead ( unit_model . TypeActions ) {
git_model . CommitStatusesHideActionsURL ( ctx , statuses )
}
ctx . Data [ "CommitStatus" ] = git_model . CalcCommitStatus ( statuses )
ctx . Data [ "CommitStatuses" ] = statuses
@ -433,3 +437,14 @@ func RawDiff(ctx *context.Context) {
return
}
}
func processGitCommits ( ctx * context . Context , gitCommits [ ] * git . Commit ) [ ] * git_model . SignCommitWithStatuses {
commits := git_model . ConvertFromGitCommit ( ctx , gitCommits , ctx . Repo . Repository )
if ! ctx . Repo . CanRead ( unit_model . TypeActions ) {
for _ , commit := range commits {
commit . Status . HideActionsURL ( ctx )
git_model . CommitStatusesHideActionsURL ( ctx , commit . Statuses )
}
}
return commits
}