- commit
- 14c87fe
- parent
- dc33a1f
- author
- jolheiser
- date
- 2024-07-22 11:43:15 -0400 EDT
fix: insert repoID with pr creation We need to add the repoID when a new pr is created. As well, all NullXXX when inserting should be set to Valid. Signed-off-by: jolheiser <git@jolheiser.com>
1 files changed,
+11,
-8
M
pr.go
M
pr.go
+11,
-8
1@@ -54,8 +54,10 @@ type PrCmd struct {
2 Backend *Backend
3 }
4
5-var _ GitPatchRequest = PrCmd{}
6-var _ GitPatchRequest = (*PrCmd)(nil)
7+var (
8+ _ GitPatchRequest = PrCmd{}
9+ _ GitPatchRequest = (*PrCmd)(nil)
10+)
11
12 func (pr PrCmd) IsBanned(pubkey, ipAddress string) error {
13 acl := []*Acl{}
14@@ -319,7 +321,7 @@ func (cmd PrCmd) UpdatePatchRequestStatus(prID int64, userID int64, status strin
15
16 err = cmd.CreateEventLog(tx, EventLog{
17 UserID: userID,
18- PatchRequestID: sql.NullInt64{Int64: prID},
19+ PatchRequestID: sql.NullInt64{Int64: prID, Valid: true},
20 Event: "pr_status_changed",
21 Data: fmt.Sprintf(`{"status":"%s"}`, status),
22 })
23@@ -355,7 +357,7 @@ func (cmd PrCmd) UpdatePatchRequestName(prID int64, userID int64, name string) e
24
25 err = cmd.CreateEventLog(tx, EventLog{
26 UserID: userID,
27- PatchRequestID: sql.NullInt64{Int64: prID},
28+ PatchRequestID: sql.NullInt64{Int64: prID, Valid: true},
29 Event: "pr_name_changed",
30 Data: fmt.Sprintf(`{"name":"%s"}`, name),
31 })
32@@ -509,8 +511,9 @@ func (cmd PrCmd) SubmitPatchRequest(repoID string, userID int64, patchset io.Rea
33
34 err = cmd.CreateEventLog(tx, EventLog{
35 UserID: userID,
36- PatchRequestID: sql.NullInt64{Int64: prID},
37- PatchsetID: sql.NullInt64{Int64: patchsetID},
38+ RepoID: repoID,
39+ PatchRequestID: sql.NullInt64{Int64: prID, Valid: true},
40+ PatchsetID: sql.NullInt64{Int64: patchsetID, Valid: true},
41 Event: "pr_created",
42 })
43 if err != nil {
44@@ -581,8 +584,8 @@ func (cmd PrCmd) SubmitPatchset(prID int64, userID int64, op PatchsetOp, patchse
45
46 err = cmd.CreateEventLog(tx, EventLog{
47 UserID: userID,
48- PatchRequestID: sql.NullInt64{Int64: prID},
49- PatchsetID: sql.NullInt64{Int64: patchsetID},
50+ PatchRequestID: sql.NullInt64{Int64: prID, Valid: true},
51+ PatchsetID: sql.NullInt64{Int64: patchsetID, Valid: true},
52 Event: event,
53 })
54 if err != nil {