dashboard / pico / feat(prose): live journal #12 rss

closed · opened on 2024-08-01T14:25:45Z by erock
Help
# add changes to patch request
git format-patch main --stdout | ssh pr.pico.sh pr add 12
# add review to patch request
git format-patch main --stdout | ssh pr.pico.sh pr add --review 12
# remove patchset
ssh pr.pico.sh ps rm ps-x
# checkout all patches
ssh pr.pico.sh pr print 12 | git am -3
# print a diff between the last two patches in a patch request
ssh pr.pico.sh pr diff 12
# accept PR
ssh pr.pico.sh pr accept 12
# close PR
ssh pr.pico.sh pr close 12

Logs

jolheiser created pr with ps-20 on 2024-07-22T17:56:38Z
erock reviewed pr with ps-23 on 2024-07-22T18:28:48Z
erock changed status on 2024-07-22T18:28:48Z {"status":"reviewed"}

Patchsets

ps-20 by jolheiser on 2024-07-22T17:56:38Z
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
ps-23 by erock on 2024-07-22T18:28:48Z

Patchset ps-23

lgtm

Eric Bower
2024-07-22T18:28:00Z

fix: log admin as closer

jolheiser
2024-07-22T17:56:18Z
cli.go
+7 -2

chore: update `pr reopen` cmd as well

Eric Bower
2024-07-22T18:26:44Z
cli.go
+7 -2
Back to top

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
 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
 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)