Logs
Patchsets
Range Diff ↕
-: ------- > 1: 0d8b33f lgtm
2: 1743c59 ! 1: 49da24b fix: log admin as closer
@@ cli.go
return err
}
- user, err := pr.GetUserByID(patchReq.UserID)
+ patchUser, err := pr.GetUserByID(patchReq.UserID)
if err != nil {
return err
}
pk := sesh.PublicKey()
- isContrib := pubkey == user.Pubkey
+ isContrib := pubkey == patchUser.Pubkey
isAdmin := be.IsAdmin(pk)
if !isAdmin && !isContrib {
return fmt.Errorf("you are not authorized to change PR status")
return fmt.Errorf("PR has already been closed")
}
+ user, err := pr.UpsertUser(pubkey, userName)
+ if err != nil {
+ return err
+ }
+
err = pr.UpdatePatchRequestStatus(prID, user.ID, "closed")
if err != nil {
return err
-: ------- > 3: 0d8b33f chore: update `pr reopen` cmd as well
Patchset ps-23
lgtm
Eric Bower
fix: log admin as closer
jolheiser
cli.go
+7
-2
chore: update `pr reopen` cmd as well
Eric Bower
cli.go
+7
-2
lgtm
I think we need the same logic for the `pr reopen` cmd as well Eric Bower (1): chore: update `pr reopen` cmd as well jolheiser (1): fix: log admin as closer cli.go | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) base-commit: 31fcd4a1f446368c4f1db8427282ee0222962f1f -- 2.45.2
fix: log admin as closer
Previously the contributor was logged as the closer, even when an admin closed a pr Signed-off-by: jolheiser <git@jolheiser.com>
cli.go
link
+7
-2
+7
-2
1diff --git a/cli.go b/cli.go
2index 40d9a04..5c103b5 100644
3--- a/cli.go
4+++ b/cli.go
5@@ -619,13 +619,13 @@ Here's how it works:
6 return err
7 }
8
9- user, err := pr.GetUserByID(patchReq.UserID)
10+ patchUser, err := pr.GetUserByID(patchReq.UserID)
11 if err != nil {
12 return err
13 }
14
15 pk := sesh.PublicKey()
16- isContrib := pubkey == user.Pubkey
17+ isContrib := pubkey == patchUser.Pubkey
18 isAdmin := be.IsAdmin(pk)
19 if !isAdmin && !isContrib {
20 return fmt.Errorf("you are not authorized to change PR status")
21@@ -635,6 +635,11 @@ Here's how it works:
22 return fmt.Errorf("PR has already been closed")
23 }
24
25+ user, err := pr.UpsertUser(pubkey, userName)
26+ if err != nil {
27+ return err
28+ }
29+
30 err = pr.UpdatePatchRequestStatus(prID, user.ID, "closed")
31 if err != nil {
32 return err
chore: update `pr reopen` cmd as well
cli.go
link
+7
-2
+7
-2
1diff --git a/cli.go b/cli.go
2index 5c103b5..d54dc93 100644
3--- a/cli.go
4+++ b/cli.go
5@@ -669,13 +669,13 @@ Here's how it works:
6 return err
7 }
8
9- user, err := pr.GetUserByID(patchReq.UserID)
10+ patchUser, err := pr.GetUserByID(patchReq.UserID)
11 if err != nil {
12 return err
13 }
14
15 pk := sesh.PublicKey()
16- isContrib := pubkey == user.Pubkey
17+ isContrib := pubkey == patchUser.Pubkey
18 isAdmin := be.IsAdmin(pk)
19 if !isAdmin && !isContrib {
20 return fmt.Errorf("you are not authorized to change PR status")
21@@ -685,6 +685,11 @@ Here's how it works:
22 return fmt.Errorf("PR is already open")
23 }
24
25+ user, err := pr.UpsertUser(pubkey, userName)
26+ if err != nil {
27+ return err
28+ }
29+
30 err = pr.UpdatePatchRequestStatus(prID, user.ID, "open")
31 if err == nil {
32 wish.Printf(sesh, "Reopened PR %s (#%d)\n", patchReq.Name, patchReq.ID)