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 ↕ rd-23
-: ------- > 1: 0d8b33f lgtm
1: 1743c59 ! 2: 49da24b fix: log admin as closer
-: ------- > 3: 0d8b33f chore: update `pr reopen` cmd as well
ps-23 by erock on 2024-07-22T18:28:48Z

Patchset ps-20

fix: log admin as closer

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

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