Skip to content

Commit 4f27d60

Browse files
committed
Merge remote-tracking branch 'giteaofficial/main'
* giteaofficial/main: Fix javascript error when an anonymous user visiting migration page (go-gitea#32144) Make oauth2 code clear. Move oauth2 provider code to their own packages/files (go-gitea#32148) Support repo license (go-gitea#24872) Fix the logic of finding the latest pull review commit ID (go-gitea#32139) Ensure `GetCSRF` doesn't return an empty token (go-gitea#32130) Bump minio-go to latest version (go-gitea#32156)
2 parents 30e6a94 + a989404 commit 4f27d60

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

77 files changed

+2006
-1023
lines changed

assets/go-licenses.json

Lines changed: 10 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

build/generate-licenses.go

Lines changed: 59 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,15 @@
1+
// Copyright 2017 The Gitea Authors. All rights reserved.
2+
// SPDX-License-Identifier: MIT
3+
14
//go:build ignore
25

36
package main
47

58
import (
69
"archive/tar"
710
"compress/gzip"
11+
"crypto/md5"
12+
"encoding/hex"
813
"flag"
914
"fmt"
1015
"io"
@@ -15,6 +20,8 @@ import (
1520
"path/filepath"
1621
"strings"
1722

23+
"code.gitea.io/gitea/build/license"
24+
"code.gitea.io/gitea/modules/json"
1825
"code.gitea.io/gitea/modules/util"
1926
)
2027

@@ -77,7 +84,7 @@ func main() {
7784
}
7885

7986
tr := tar.NewReader(gz)
80-
87+
aliasesFiles := make(map[string][]string)
8188
for {
8289
hdr, err := tr.Next()
8390

@@ -97,26 +104,73 @@ func main() {
97104
continue
98105
}
99106

100-
if strings.HasPrefix(filepath.Base(hdr.Name), "README") {
107+
fileBaseName := filepath.Base(hdr.Name)
108+
licenseName := strings.TrimSuffix(fileBaseName, ".txt")
109+
110+
if strings.HasPrefix(fileBaseName, "README") {
101111
continue
102112
}
103113

104-
if strings.HasPrefix(filepath.Base(hdr.Name), "deprecated_") {
114+
if strings.HasPrefix(fileBaseName, "deprecated_") {
105115
continue
106116
}
107-
out, err := os.Create(path.Join(destination, strings.TrimSuffix(filepath.Base(hdr.Name), ".txt")))
117+
out, err := os.Create(path.Join(destination, licenseName))
108118
if err != nil {
109119
log.Fatalf("Failed to create new file. %s", err)
110120
}
111121

112122
defer out.Close()
113123

114-
if _, err := io.Copy(out, tr); err != nil {
124+
// some license files have same content, so we need to detect these files and create a convert map into a json file
125+
// Later we use this convert map to avoid adding same license content with different license name
126+
h := md5.New()
127+
// calculate md5 and write file in the same time
128+
r := io.TeeReader(tr, h)
129+
if _, err := io.Copy(out, r); err != nil {
115130
log.Fatalf("Failed to write new file. %s", err)
116131
} else {
117132
fmt.Printf("Written %s\n", out.Name())
133+
134+
md5 := hex.EncodeToString(h.Sum(nil))
135+
aliasesFiles[md5] = append(aliasesFiles[md5], licenseName)
118136
}
119137
}
120138

139+
// generate convert license name map
140+
licenseAliases := make(map[string]string)
141+
for _, fileNames := range aliasesFiles {
142+
if len(fileNames) > 1 {
143+
licenseName := license.GetLicenseNameFromAliases(fileNames)
144+
if licenseName == "" {
145+
// license name should not be empty as expected
146+
// if it is empty, we need to rewrite the logic of GetLicenseNameFromAliases
147+
log.Fatalf("GetLicenseNameFromAliases: license name is empty")
148+
}
149+
for _, fileName := range fileNames {
150+
licenseAliases[fileName] = licenseName
151+
}
152+
}
153+
}
154+
// save convert license name map to file
155+
b, err := json.Marshal(licenseAliases)
156+
if err != nil {
157+
log.Fatalf("Failed to create json bytes. %s", err)
158+
}
159+
160+
licenseAliasesDestination := filepath.Join(destination, "etc", "license-aliases.json")
161+
if err := os.MkdirAll(filepath.Dir(licenseAliasesDestination), 0o755); err != nil {
162+
log.Fatalf("Failed to create directory for license aliases json file. %s", err)
163+
}
164+
165+
f, err := os.Create(licenseAliasesDestination)
166+
if err != nil {
167+
log.Fatalf("Failed to create license aliases json file. %s", err)
168+
}
169+
defer f.Close()
170+
171+
if _, err = f.Write(b); err != nil {
172+
log.Fatalf("Failed to write license aliases json file. %s", err)
173+
}
174+
121175
fmt.Println("Done")
122176
}

build/license/aliasgenerator.go

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
// Copyright 2024 The Gitea Authors. All rights reserved.
2+
// SPDX-License-Identifier: MIT
3+
4+
package license
5+
6+
import "strings"
7+
8+
func GetLicenseNameFromAliases(fnl []string) string {
9+
if len(fnl) == 0 {
10+
return ""
11+
}
12+
13+
shortestItem := func(list []string) string {
14+
s := list[0]
15+
for _, l := range list[1:] {
16+
if len(l) < len(s) {
17+
s = l
18+
}
19+
}
20+
return s
21+
}
22+
allHasPrefix := func(list []string, s string) bool {
23+
for _, l := range list {
24+
if !strings.HasPrefix(l, s) {
25+
return false
26+
}
27+
}
28+
return true
29+
}
30+
31+
sl := shortestItem(fnl)
32+
slv := strings.Split(sl, "-")
33+
var result string
34+
for i := len(slv); i >= 0; i-- {
35+
result = strings.Join(slv[:i], "-")
36+
if allHasPrefix(fnl, result) {
37+
return result
38+
}
39+
}
40+
return ""
41+
}

build/license/aliasgenerator_test.go

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
// Copyright 2024 The Gitea Authors. All rights reserved.
2+
// SPDX-License-Identifier: MIT
3+
4+
package license
5+
6+
import (
7+
"testing"
8+
9+
"github.com/stretchr/testify/assert"
10+
)
11+
12+
func TestGetLicenseNameFromAliases(t *testing.T) {
13+
tests := []struct {
14+
target string
15+
inputs []string
16+
}{
17+
{
18+
// real case which you can find in license-aliases.json
19+
target: "AGPL-1.0",
20+
inputs: []string{
21+
"AGPL-1.0-only",
22+
"AGPL-1.0-or-late",
23+
},
24+
},
25+
{
26+
target: "",
27+
inputs: []string{
28+
"APSL-1.0",
29+
"AGPL-1.0-only",
30+
"AGPL-1.0-or-late",
31+
},
32+
},
33+
}
34+
35+
for _, tt := range tests {
36+
result := GetLicenseNameFromAliases(tt.inputs)
37+
assert.Equal(t, result, tt.target)
38+
}
39+
}

go.mod

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ require (
6868
github.com/gogs/go-gogs-client v0.0.0-20210131175652-1d7215cd8d85
6969
github.com/golang-jwt/jwt/v5 v5.2.1
7070
github.com/google/go-github/v61 v61.0.0
71+
github.com/google/licenseclassifier/v2 v2.0.0
7172
github.com/google/pprof v0.0.0-20240618054019-d3b898a103f8
7273
github.com/google/uuid v1.6.0
7374
github.com/gorilla/feeds v1.2.0
@@ -91,7 +92,7 @@ require (
9192
github.com/mholt/archiver/v3 v3.5.1
9293
github.com/microcosm-cc/bluemonday v1.0.26
9394
github.com/microsoft/go-mssqldb v1.7.2
94-
github.com/minio/minio-go/v7 v7.0.71
95+
github.com/minio/minio-go/v7 v7.0.77
9596
github.com/msteinert/pam v1.2.0
9697
github.com/nektos/act v0.2.63
9798
github.com/niklasfasching/go-org v1.7.0
@@ -123,7 +124,7 @@ require (
123124
golang.org/x/image v0.18.0
124125
golang.org/x/net v0.28.0
125126
golang.org/x/oauth2 v0.21.0
126-
golang.org/x/sys v0.23.0
127+
golang.org/x/sys v0.24.0
127128
golang.org/x/text v0.17.0
128129
golang.org/x/tools v0.24.0
129130
google.golang.org/grpc v1.62.1
@@ -206,6 +207,7 @@ require (
206207
github.com/go-faster/errors v0.7.1 // indirect
207208
github.com/go-fed/httpsig v1.1.1-0.20201223112313-55836744818e // indirect
208209
github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376 // indirect
210+
github.com/go-ini/ini v1.67.0 // indirect
209211
github.com/go-openapi/analysis v0.23.0 // indirect
210212
github.com/go-openapi/errors v0.22.0 // indirect
211213
github.com/go-openapi/inflect v0.21.0 // indirect
@@ -280,7 +282,7 @@ require (
280282
github.com/rhysd/actionlint v1.7.1 // indirect
281283
github.com/rivo/uniseg v0.4.7 // indirect
282284
github.com/rogpeppe/go-internal v1.12.0 // indirect
283-
github.com/rs/xid v1.5.0 // indirect
285+
github.com/rs/xid v1.6.0 // indirect
284286
github.com/russross/blackfriday/v2 v2.1.0 // indirect
285287
github.com/sagikazarmark/locafero v0.4.0 // indirect
286288
github.com/sagikazarmark/slog-shim v0.1.0 // indirect

go.sum

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -334,6 +334,8 @@ github.com/go-git/go-git-fixtures/v4 v4.3.2-0.20231010084843-55a94097c399 h1:eMj
334334
github.com/go-git/go-git-fixtures/v4 v4.3.2-0.20231010084843-55a94097c399/go.mod h1:1OCfN199q1Jm3HZlxleg+Dw/mwps2Wbk9frAWm+4FII=
335335
github.com/go-git/go-git/v5 v5.12.0 h1:7Md+ndsjrzZxbddRDZjF14qK+NN56sy6wkqaVrjZtys=
336336
github.com/go-git/go-git/v5 v5.12.0/go.mod h1:FTM9VKtnI2m65hNI/TenDDDnUf2Q9FHnXYjuz9i5OEY=
337+
github.com/go-ini/ini v1.67.0 h1:z6ZrTEZqSWOTyH2FlglNbNgARyHG8oLW9gMELqKr06A=
338+
github.com/go-ini/ini v1.67.0/go.mod h1:ByCAeIL28uOIIG0E3PJtZPDL8WnHpFKFOtgjp+3Ies8=
337339
github.com/go-ldap/ldap/v3 v3.4.6 h1:ert95MdbiG7aWo/oPYp9btL3KJlMPKnP58r09rI8T+A=
338340
github.com/go-ldap/ldap/v3 v3.4.6/go.mod h1:IGMQANNtxpsOzj7uUAMjpGBaOVTC4DYyIy8VsTdxmtc=
339341
github.com/go-openapi/analysis v0.23.0 h1:aGday7OWupfMs+LbmLZG4k0MYXIANxcuBTYUC03zFCU=
@@ -439,6 +441,8 @@ github.com/google/go-tpm v0.9.0/go.mod h1:FkNVkc6C+IsvDI9Jw1OveJmxGZUUaKxtrpOS47
439441
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
440442
github.com/google/gofuzz v1.2.0 h1:xRy4A+RhZaiKjJ1bPfwQ8sedCA+YS2YcCHW6ec7JMi0=
441443
github.com/google/gofuzz v1.2.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
444+
github.com/google/licenseclassifier/v2 v2.0.0 h1:1Y57HHILNf4m0ABuMVb6xk4vAJYEUO0gDxNpog0pyeA=
445+
github.com/google/licenseclassifier/v2 v2.0.0/go.mod h1:cOjbdH0kyC9R22sdQbYsFkto4NGCAc+ZSwbeThazEtM=
442446
github.com/google/pprof v0.0.0-20240227163752-401108e1b7e7/go.mod h1:czg5+yv1E0ZGTi6S6vVK1mke0fV+FaUhNGcd6VRS9Ik=
443447
github.com/google/pprof v0.0.0-20240618054019-d3b898a103f8 h1:ASJ/LAqdCHOyMYI+dwNxn7Rd8FscNkMyTr1KZU1JI/M=
444448
github.com/google/pprof v0.0.0-20240618054019-d3b898a103f8/go.mod h1:K1liHPHnj73Fdn/EKuT8nrFqBihUSKXoLYU0BuatOYo=
@@ -607,8 +611,8 @@ github.com/miekg/dns v1.1.61 h1:nLxbwF3XxhwVSm8g9Dghm9MHPaUZuqhPiGL+675ZmEs=
607611
github.com/miekg/dns v1.1.61/go.mod h1:mnAarhS3nWaW+NVP2wTkYVIZyHNJ098SJZUki3eykwQ=
608612
github.com/minio/md5-simd v1.1.2 h1:Gdi1DZK69+ZVMoNHRXJyNcxrMA4dSxoYHZSQbirFg34=
609613
github.com/minio/md5-simd v1.1.2/go.mod h1:MzdKDxYpY2BT9XQFocsiZf/NKVtR7nkE4RoEpN+20RM=
610-
github.com/minio/minio-go/v7 v7.0.71 h1:No9XfOKTYi6i0GnBj+WZwD8WP5GZfL7n7GOjRqCdAjA=
611-
github.com/minio/minio-go/v7 v7.0.71/go.mod h1:4yBA8v80xGA30cfM3fz0DKYMXunWl/AV/6tWEs9ryzo=
614+
github.com/minio/minio-go/v7 v7.0.77 h1:GaGghJRg9nwDVlNbwYjSDJT1rqltQkBFDsypWX1v3Bw=
615+
github.com/minio/minio-go/v7 v7.0.77/go.mod h1:AVM3IUN6WwKzmwBxVdjzhH8xq+f57JSbbvzqvUzR6eg=
612616
github.com/mitchellh/copystructure v1.0.0/go.mod h1:SNtv71yrdKgLRyLFxmLdkAbkKEFWgYaq1OVrnRcwhnw=
613617
github.com/mitchellh/copystructure v1.2.0 h1:vpKXTN4ewci03Vljg/q9QvCGUDttBOGBIa15WveJJGw=
614618
github.com/mitchellh/copystructure v1.2.0/go.mod h1:qLl+cE2AmVv+CoeAwDPye/v+N2HKCj9FbZEVFJRxO9s=
@@ -717,8 +721,8 @@ github.com/rogpeppe/go-internal v1.8.1/go.mod h1:JeRgkft04UBgHMgCIwADu4Pn6Mtm5d4
717721
github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs=
718722
github.com/rogpeppe/go-internal v1.12.0 h1:exVL4IDcn6na9z1rAb56Vxr+CgyK3nn3O+epU5NdKM8=
719723
github.com/rogpeppe/go-internal v1.12.0/go.mod h1:E+RYuTGaKKdloAfM02xzb0FW3Paa99yedzYV+kq4uf4=
720-
github.com/rs/xid v1.5.0 h1:mKX4bl4iPYJtEIxp6CYiUuLQ/8DYMoz0PUdtGgMFRVc=
721-
github.com/rs/xid v1.5.0/go.mod h1:trrq9SKmegXys3aeAKXMUTdJsYXVwGY3RLcfgqegfbg=
724+
github.com/rs/xid v1.6.0 h1:fV591PaemRlL6JfRxGDEPl69wICngIQ3shQtzfy2gxU=
725+
github.com/rs/xid v1.6.0/go.mod h1:7XoLgs4eV+QndskICGsho+ADou8ySMSjJKDIan90Nz0=
722726
github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g=
723727
github.com/russross/blackfriday/v2 v2.1.0 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf35Ld67mk=
724728
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
@@ -733,6 +737,7 @@ github.com/sassoftware/go-rpmutils v0.4.0/go.mod h1:3goNWi7PGAT3/dlql2lv3+MSN5jN
733737
github.com/segmentio/asm v1.2.0 h1:9BQrFxC+YOHJlTlHGkTrFWf59nbL3XnCoFLTwDCI7ys=
734738
github.com/segmentio/asm v1.2.0/go.mod h1:BqMnlJP91P8d+4ibuonYZw9mfnzI9HfxselHZr5aAcs=
735739
github.com/serenize/snaker v0.0.0-20171204205717-a683aaf2d516/go.mod h1:Yow6lPLSAXx2ifx470yD/nUe22Dv5vBvxK/UK9UUTVs=
740+
github.com/sergi/go-diff v1.1.0/go.mod h1:STckp+ISIX8hZLjrqAeVduY0gWCT9IjLuqbuNXdaHfM=
736741
github.com/sergi/go-diff v1.3.2-0.20230802210424-5b0b94c5c0d3 h1:n661drycOFuPLCN3Uc8sB6B/s6Z4t2xvBgU1htSHuq8=
737742
github.com/sergi/go-diff v1.3.2-0.20230802210424-5b0b94c5c0d3/go.mod h1:A0bzQcvG0E7Rwjx0REVgAGH58e96+X0MeOfepqsbeW4=
738743
github.com/shopspring/decimal v1.2.0/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFRcu2hWCYk4o=
@@ -973,8 +978,8 @@ golang.org/x/sys v0.7.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
973978
golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
974979
golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
975980
golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
976-
golang.org/x/sys v0.23.0 h1:YfKFowiIMvtgl1UERQoTPPToxltDeZfbj4H7dVUCwmM=
977-
golang.org/x/sys v0.23.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
981+
golang.org/x/sys v0.24.0 h1:Twjiwq9dn6R1fQcyiK+wQyHWfaz/BJB+YIpzU/Cv3Xg=
982+
golang.org/x/sys v0.24.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
978983
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
979984
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
980985
golang.org/x/term v0.2.0/go.mod h1:TVmDHMZPmdnySmBfhjOoOdhjzdE1h4u1VwSiw2l1Nuc=

models/admin/task.go

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -179,27 +179,6 @@ func GetMigratingTask(ctx context.Context, repoID int64) (*Task, error) {
179179
return &task, nil
180180
}
181181

182-
// GetMigratingTaskByID returns the migrating task by repo's id
183-
func GetMigratingTaskByID(ctx context.Context, id, doerID int64) (*Task, *migration.MigrateOptions, error) {
184-
task := Task{
185-
ID: id,
186-
DoerID: doerID,
187-
Type: structs.TaskTypeMigrateRepo,
188-
}
189-
has, err := db.GetEngine(ctx).Get(&task)
190-
if err != nil {
191-
return nil, nil, err
192-
} else if !has {
193-
return nil, nil, ErrTaskDoesNotExist{id, 0, task.Type}
194-
}
195-
196-
var opts migration.MigrateOptions
197-
if err := json.Unmarshal([]byte(task.PayloadContent), &opts); err != nil {
198-
return nil, nil, err
199-
}
200-
return &task, &opts, nil
201-
}
202-
203182
// CreateTask creates a task on database
204183
func CreateTask(ctx context.Context, task *Task) error {
205184
return db.Insert(ctx, task)

models/fixtures/comment.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,3 +83,22 @@
8383
issue_id: 2 # in repo_id 1
8484
review_id: 20
8585
created_unix: 946684810
86+
87+
-
88+
id: 10
89+
type: 22 # review
90+
poster_id: 5
91+
issue_id: 3 # in repo_id 1
92+
content: "reviewed by user5"
93+
review_id: 21
94+
created_unix: 946684816
95+
96+
-
97+
id: 11
98+
type: 27 # review request
99+
poster_id: 2
100+
issue_id: 3 # in repo_id 1
101+
content: "review request for user5"
102+
review_id: 22
103+
assignee_id: 5
104+
created_unix: 946684817

models/fixtures/repo_license.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
[] # empty

models/fixtures/repository.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
fork_id: 0
2727
is_template: false
2828
template_id: 0
29-
size: 7597
29+
size: 8478
3030
is_fsck_enabled: true
3131
close_issues_via_commit_in_any_branch: false
3232

models/fixtures/review.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,3 +179,22 @@
179179
content: "Review Comment"
180180
updated_unix: 946684810
181181
created_unix: 946684810
182+
183+
-
184+
id: 21
185+
type: 2
186+
reviewer_id: 5
187+
issue_id: 3
188+
content: "reviewed by user5"
189+
commit_id: 4a357436d925b5c974181ff12a994538ddc5a269
190+
updated_unix: 946684816
191+
created_unix: 946684816
192+
193+
-
194+
id: 22
195+
type: 4
196+
reviewer_id: 5
197+
issue_id: 3
198+
content: "review request for user5"
199+
updated_unix: 946684817
200+
created_unix: 946684817

models/issues/pull.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -414,7 +414,7 @@ func (pr *PullRequest) getReviewedByLines(ctx context.Context, writer io.Writer)
414414

415415
// Note: This doesn't page as we only expect a very limited number of reviews
416416
reviews, err := FindLatestReviews(ctx, FindReviewOptions{
417-
Type: ReviewTypeApprove,
417+
Types: []ReviewType{ReviewTypeApprove},
418418
IssueID: pr.IssueID,
419419
OfficialOnly: setting.Repository.PullRequest.DefaultMergeMessageOfficialApproversOnly,
420420
})

models/issues/review.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -389,7 +389,7 @@ func GetCurrentReview(ctx context.Context, reviewer *user_model.User, issue *Iss
389389
return nil, nil
390390
}
391391
reviews, err := FindReviews(ctx, FindReviewOptions{
392-
Type: ReviewTypePending,
392+
Types: []ReviewType{ReviewTypePending},
393393
IssueID: issue.ID,
394394
ReviewerID: reviewer.ID,
395395
})

0 commit comments

Comments
 (0)