repos / git-pr

a self-hosted git collaboration server
git clone https://github.com/picosh/git-pr.git

commit
a8a568a
parent
9babd07
author
Eric Bower
date
2024-07-22 14:26:44 -0400 EDT
chore: update `pr reopen` cmd as well
1 files changed,  +7, -2
M cli.go
M cli.go
+7, -2
 1@@ -669,13 +669,13 @@ Here's how it works:
 2 								return err
 3 							}
 4 
 5-							user, err := pr.GetUserByID(patchReq.UserID)
 6+							patchUser, err := pr.GetUserByID(patchReq.UserID)
 7 							if err != nil {
 8 								return err
 9 							}
10 
11 							pk := sesh.PublicKey()
12-							isContrib := pubkey == user.Pubkey
13+							isContrib := pubkey == patchUser.Pubkey
14 							isAdmin := be.IsAdmin(pk)
15 							if !isAdmin && !isContrib {
16 								return fmt.Errorf("you are not authorized to change PR status")
17@@ -685,6 +685,11 @@ Here's how it works:
18 								return fmt.Errorf("PR is already open")
19 							}
20 
21+							user, err := pr.UpsertUser(pubkey, userName)
22+							if err != nil {
23+								return err
24+							}
25+
26 							err = pr.UpdatePatchRequestStatus(prID, user.ID, "open")
27 							if err == nil {
28 								wish.Printf(sesh, "Reopened PR %s (#%d)\n", patchReq.Name, patchReq.ID)