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
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 93869c8..7d6da9c 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