Logs
Patchset ps-19
REVIEW
lgtm
Eric Bower
fix: insert repoID with pr creation
jolheiser
pr.go
+11
-8
lgtm
thanks! jolheiser (1): fix: insert repoID with pr creation pr.go | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) base-commit: dc33a1fb8df6734297a961cd08dc6e5b4f08730a -- 2.45.2
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>
pr.go
link
+11
-8
+11
-8
1diff --git a/pr.go b/pr.go
2index d9aa55d..9e535a0 100644
3--- a/pr.go
4+++ b/pr.go
5@@ -54,8 +54,10 @@ type PrCmd struct {
6 Backend *Backend
7 }
8
9-var _ GitPatchRequest = PrCmd{}
10-var _ GitPatchRequest = (*PrCmd)(nil)
11+var (
12+ _ GitPatchRequest = PrCmd{}
13+ _ GitPatchRequest = (*PrCmd)(nil)
14+)
15
16 func (pr PrCmd) IsBanned(pubkey, ipAddress string) error {
17 acl := []*Acl{}
18@@ -319,7 +321,7 @@ func (cmd PrCmd) UpdatePatchRequestStatus(prID int64, userID int64, status strin
19
20 err = cmd.CreateEventLog(tx, EventLog{
21 UserID: userID,
22- PatchRequestID: sql.NullInt64{Int64: prID},
23+ PatchRequestID: sql.NullInt64{Int64: prID, Valid: true},
24 Event: "pr_status_changed",
25 Data: fmt.Sprintf(`{"status":"%s"}`, status),
26 })
27@@ -355,7 +357,7 @@ func (cmd PrCmd) UpdatePatchRequestName(prID int64, userID int64, name string) e
28
29 err = cmd.CreateEventLog(tx, EventLog{
30 UserID: userID,
31- PatchRequestID: sql.NullInt64{Int64: prID},
32+ PatchRequestID: sql.NullInt64{Int64: prID, Valid: true},
33 Event: "pr_name_changed",
34 Data: fmt.Sprintf(`{"name":"%s"}`, name),
35 })
36@@ -509,8 +511,9 @@ func (cmd PrCmd) SubmitPatchRequest(repoID string, userID int64, patchset io.Rea
37
38 err = cmd.CreateEventLog(tx, EventLog{
39 UserID: userID,
40- PatchRequestID: sql.NullInt64{Int64: prID},
41- PatchsetID: sql.NullInt64{Int64: patchsetID},
42+ RepoID: repoID,
43+ PatchRequestID: sql.NullInt64{Int64: prID, Valid: true},
44+ PatchsetID: sql.NullInt64{Int64: patchsetID, Valid: true},
45 Event: "pr_created",
46 })
47 if err != nil {
48@@ -581,8 +584,8 @@ func (cmd PrCmd) SubmitPatchset(prID int64, userID int64, op PatchsetOp, patchse
49
50 err = cmd.CreateEventLog(tx, EventLog{
51 UserID: userID,
52- PatchRequestID: sql.NullInt64{Int64: prID},
53- PatchsetID: sql.NullInt64{Int64: patchsetID},
54+ PatchRequestID: sql.NullInt64{Int64: prID, Valid: true},
55+ PatchsetID: sql.NullInt64{Int64: patchsetID, Valid: true},
56 Event: event,
57 })
58 if err != nil {