summaryrefslogtreecommitdiffstats
path: root/routers
diff options
context:
space:
mode:
authorzeripath <art27@cantab.net>2022-02-03 16:20:37 +0000
committerGitHub <noreply@github.com>2022-02-03 11:20:37 -0500
commitbc196a35e1c74f26d941aefbfde1733c2a989a6b (patch)
treec107fa362b9e505312eec5f9814fec2a1daacc80 /routers
parent8d31cfbfff63d01150c131e674708ee7ed2e430d (diff)
downloadgitea-bc196a35e1c74f26d941aefbfde1733c2a989a6b.tar.gz
gitea-bc196a35e1c74f26d941aefbfde1733c2a989a6b.zip
Collaborator trust model should trust collaborators (#18539) (#18557)
Backport #18539 There was an unintended regression in #17917 which leads to only repository admin commits being trusted. This PR restores the old logic. Fix #18501 Signed-off-by: Andrew Thornton <art27@cantab.net> Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Diffstat (limited to 'routers')
-rw-r--r--routers/web/repo/commit.go2
-rw-r--r--routers/web/repo/view.go2
2 files changed, 2 insertions, 2 deletions
diff --git a/routers/web/repo/commit.go b/routers/web/repo/commit.go
index 304f76158c..6b890ac484 100644
--- a/routers/web/repo/commit.go
+++ b/routers/web/repo/commit.go
@@ -351,7 +351,7 @@ func Diff(ctx *context.Context) {
ctx.Data["DiffNotAvailable"] = diff.NumFiles == 0
if err := asymkey_model.CalculateTrustStatus(verification, ctx.Repo.Repository.GetTrustModel(), func(user *user_model.User) (bool, error) {
- return models.IsUserRepoAdmin(ctx.Repo.Repository, user)
+ return models.IsOwnerMemberCollaborator(ctx.Repo.Repository, user.ID)
}, nil); err != nil {
ctx.ServerError("CalculateTrustStatus", err)
return
diff --git a/routers/web/repo/view.go b/routers/web/repo/view.go
index e8c02b64b8..4c0e881f17 100644
--- a/routers/web/repo/view.go
+++ b/routers/web/repo/view.go
@@ -800,7 +800,7 @@ func renderDirectoryFiles(ctx *context.Context, timeout time.Duration) git.Entri
verification := asymkey_model.ParseCommitWithSignature(latestCommit)
if err := asymkey_model.CalculateTrustStatus(verification, ctx.Repo.Repository.GetTrustModel(), func(user *user_model.User) (bool, error) {
- return models.IsUserRepoAdmin(ctx.Repo.Repository, user)
+ return models.IsOwnerMemberCollaborator(ctx.Repo.Repository, user.ID)
}, nil); err != nil {
ctx.ServerError("CalculateTrustStatus", err)
return nil