Skip to content

Commit 2a9b14c

Browse files
authored
Merge branch 'main' into lunny/clean_oauth2
2 parents 48fd9a3 + f4b8f6f commit 2a9b14c

File tree

20 files changed

+221
-36
lines changed

20 files changed

+221
-36
lines changed

assets/go-licenses.json

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

go.mod

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ require (
9191
github.com/mholt/archiver/v3 v3.5.1
9292
github.com/microcosm-cc/bluemonday v1.0.26
9393
github.com/microsoft/go-mssqldb v1.7.2
94-
github.com/minio/minio-go/v7 v7.0.71
94+
github.com/minio/minio-go/v7 v7.0.77
9595
github.com/msteinert/pam v1.2.0
9696
github.com/nektos/act v0.2.63
9797
github.com/niklasfasching/go-org v1.7.0
@@ -123,7 +123,7 @@ require (
123123
golang.org/x/image v0.18.0
124124
golang.org/x/net v0.28.0
125125
golang.org/x/oauth2 v0.21.0
126-
golang.org/x/sys v0.23.0
126+
golang.org/x/sys v0.24.0
127127
golang.org/x/text v0.17.0
128128
golang.org/x/tools v0.24.0
129129
google.golang.org/grpc v1.62.1
@@ -206,6 +206,7 @@ require (
206206
github.com/go-faster/errors v0.7.1 // indirect
207207
github.com/go-fed/httpsig v1.1.1-0.20201223112313-55836744818e // indirect
208208
github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376 // indirect
209+
github.com/go-ini/ini v1.67.0 // indirect
209210
github.com/go-openapi/analysis v0.23.0 // indirect
210211
github.com/go-openapi/errors v0.22.0 // indirect
211212
github.com/go-openapi/inflect v0.21.0 // indirect
@@ -280,7 +281,7 @@ require (
280281
github.com/rhysd/actionlint v1.7.1 // indirect
281282
github.com/rivo/uniseg v0.4.7 // indirect
282283
github.com/rogpeppe/go-internal v1.12.0 // indirect
283-
github.com/rs/xid v1.5.0 // indirect
284+
github.com/rs/xid v1.6.0 // indirect
284285
github.com/russross/blackfriday/v2 v2.1.0 // indirect
285286
github.com/sagikazarmark/locafero v0.4.0 // indirect
286287
github.com/sagikazarmark/slog-shim v0.1.0 // indirect

go.sum

Lines changed: 8 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=
@@ -607,8 +609,8 @@ github.com/miekg/dns v1.1.61 h1:nLxbwF3XxhwVSm8g9Dghm9MHPaUZuqhPiGL+675ZmEs=
607609
github.com/miekg/dns v1.1.61/go.mod h1:mnAarhS3nWaW+NVP2wTkYVIZyHNJ098SJZUki3eykwQ=
608610
github.com/minio/md5-simd v1.1.2 h1:Gdi1DZK69+ZVMoNHRXJyNcxrMA4dSxoYHZSQbirFg34=
609611
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=
612+
github.com/minio/minio-go/v7 v7.0.77 h1:GaGghJRg9nwDVlNbwYjSDJT1rqltQkBFDsypWX1v3Bw=
613+
github.com/minio/minio-go/v7 v7.0.77/go.mod h1:AVM3IUN6WwKzmwBxVdjzhH8xq+f57JSbbvzqvUzR6eg=
612614
github.com/mitchellh/copystructure v1.0.0/go.mod h1:SNtv71yrdKgLRyLFxmLdkAbkKEFWgYaq1OVrnRcwhnw=
613615
github.com/mitchellh/copystructure v1.2.0 h1:vpKXTN4ewci03Vljg/q9QvCGUDttBOGBIa15WveJJGw=
614616
github.com/mitchellh/copystructure v1.2.0/go.mod h1:qLl+cE2AmVv+CoeAwDPye/v+N2HKCj9FbZEVFJRxO9s=
@@ -717,8 +719,8 @@ github.com/rogpeppe/go-internal v1.8.1/go.mod h1:JeRgkft04UBgHMgCIwADu4Pn6Mtm5d4
717719
github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs=
718720
github.com/rogpeppe/go-internal v1.12.0 h1:exVL4IDcn6na9z1rAb56Vxr+CgyK3nn3O+epU5NdKM8=
719721
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=
722+
github.com/rs/xid v1.6.0 h1:fV591PaemRlL6JfRxGDEPl69wICngIQ3shQtzfy2gxU=
723+
github.com/rs/xid v1.6.0/go.mod h1:7XoLgs4eV+QndskICGsho+ADou8ySMSjJKDIan90Nz0=
722724
github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g=
723725
github.com/russross/blackfriday/v2 v2.1.0 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf35Ld67mk=
724726
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
@@ -973,8 +975,8 @@ golang.org/x/sys v0.7.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
973975
golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
974976
golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
975977
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=
978+
golang.org/x/sys v0.24.0 h1:Twjiwq9dn6R1fQcyiK+wQyHWfaz/BJB+YIpzU/Cv3Xg=
979+
golang.org/x/sys v0.24.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
978980
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
979981
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
980982
golang.org/x/term v0.2.0/go.mod h1:TVmDHMZPmdnySmBfhjOoOdhjzdE1h4u1VwSiw2l1Nuc=

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/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
})

models/issues/review_list.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ func (reviews ReviewList) LoadIssues(ctx context.Context) error {
9292
// FindReviewOptions represent possible filters to find reviews
9393
type FindReviewOptions struct {
9494
db.ListOptions
95-
Type ReviewType
95+
Types []ReviewType
9696
IssueID int64
9797
ReviewerID int64
9898
OfficialOnly bool
@@ -107,8 +107,8 @@ func (opts *FindReviewOptions) toCond() builder.Cond {
107107
if opts.ReviewerID > 0 {
108108
cond = cond.And(builder.Eq{"reviewer_id": opts.ReviewerID})
109109
}
110-
if opts.Type != ReviewTypeUnknown {
111-
cond = cond.And(builder.Eq{"type": opts.Type})
110+
if len(opts.Types) > 0 {
111+
cond = cond.And(builder.In("type", opts.Types))
112112
}
113113
if opts.OfficialOnly {
114114
cond = cond.And(builder.Eq{"official": true})

models/issues/review_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ func TestReviewType_Icon(t *testing.T) {
6363
func TestFindReviews(t *testing.T) {
6464
assert.NoError(t, unittest.PrepareTestDatabase())
6565
reviews, err := issues_model.FindReviews(db.DefaultContext, issues_model.FindReviewOptions{
66-
Type: issues_model.ReviewTypeApprove,
66+
Types: []issues_model.ReviewType{issues_model.ReviewTypeApprove},
6767
IssueID: 2,
6868
ReviewerID: 1,
6969
})
@@ -75,7 +75,7 @@ func TestFindReviews(t *testing.T) {
7575
func TestFindLatestReviews(t *testing.T) {
7676
assert.NoError(t, unittest.PrepareTestDatabase())
7777
reviews, err := issues_model.FindLatestReviews(db.DefaultContext, issues_model.FindReviewOptions{
78-
Type: issues_model.ReviewTypeApprove,
78+
Types: []issues_model.ReviewType{issues_model.ReviewTypeApprove},
7979
IssueID: 11,
8080
})
8181
assert.NoError(t, err)

modules/indexer/code/bleve/bleve.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -284,6 +284,8 @@ func (b *Indexer) Search(ctx context.Context, opts *internal.SearchOptions) (int
284284
searchRequest.AddFacet("languages", bleve.NewFacetRequest("Language", 10))
285285
}
286286

287+
searchRequest.SortBy([]string{"-_score", "UpdatedAt"})
288+
287289
result, err := b.inner.Indexer.SearchInContext(ctx, searchRequest)
288290
if err != nil {
289291
return 0, nil, nil, err

0 commit comments

Comments
 (0)