Logs
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