- commit
- 6055c43
- parent
- e70b320
- author
- Eric Bower
- date
- 2025-03-13 10:17:20 -0400 EDT
refactor: allow anyone to review or add patchsets to PR
2 files changed,
+11,
-5
M
cli.go
+10,
-4
1@@ -105,9 +105,10 @@ func (be *Backend) IsPrOwner(pka, pkb int64) bool {
2 }
3
4 type PrAcl struct {
5- CanModify bool
6- CanReview bool
7- CanDelete bool
8+ CanModify bool
9+ CanDelete bool
10+ CanReview bool
11+ CanAddPatchset bool
12 }
13
14 func (be *Backend) GetPatchRequestAcl(repo *Repo, prq *PatchRequest, requester *User) *PrAcl {
15@@ -127,6 +128,7 @@ func (be *Backend) GetPatchRequestAcl(repo *Repo, prq *PatchRequest, requester *
16 acl.CanModify = true
17 acl.CanReview = true
18 acl.CanDelete = true
19+ acl.CanAddPatchset = true
20 return acl
21 }
22
23@@ -135,6 +137,7 @@ func (be *Backend) GetPatchRequestAcl(repo *Repo, prq *PatchRequest, requester *
24 acl.CanModify = true
25 acl.CanReview = true
26 acl.CanDelete = true
27+ acl.CanAddPatchset = true
28 return acl
29 }
30
31@@ -143,13 +146,16 @@ func (be *Backend) GetPatchRequestAcl(repo *Repo, prq *PatchRequest, requester *
32 acl.CanModify = true
33 acl.CanReview = false
34 acl.CanDelete = true
35+ acl.CanAddPatchset = true
36 return acl
37 }
38
39 // otherwise no perms
40 acl.CanModify = false
41- acl.CanReview = false
42 acl.CanDelete = false
43+ // anyone can review or add a patchset
44+ acl.CanReview = true
45+ acl.CanAddPatchset = true
46
47 return acl
48 }
M
cli.go
+1,
-1
1@@ -887,7 +887,7 @@ Here's how it works:
2 }
3
4 acl := be.GetPatchRequestAcl(repo, prq, user)
5- if !acl.CanModify {
6+ if !acl.CanAddPatchset {
7 return fmt.Errorf("you are not authorized to add patchsets to pr")
8 }
9