aboutsummaryrefslogtreecommitdiffstats
path: root/modules/indexer
diff options
context:
space:
mode:
authorLunny Xiao <xiaolunwen@gmail.com>2024-03-22 20:53:52 +0800
committerGitHub <noreply@github.com>2024-03-22 13:53:52 +0100
commitf8ab9dafb7a173a35e9308f8f784735b0f822439 (patch)
tree407c8062fd1943eac09af96b54c8521445c3e48c /modules/indexer
parent29118743a58cf3172bddb6a4fa287484c62b4eb1 (diff)
downloadgitea-f8ab9dafb7a173a35e9308f8f784735b0f822439.tar.gz
gitea-f8ab9dafb7a173a35e9308f8f784735b0f822439.zip
Use db.ListOptionsAll instead of db.ListOptions{ListAll: true} (#29995)
Diffstat (limited to 'modules/indexer')
-rw-r--r--modules/indexer/issues/internal/tests/tests.go48
-rw-r--r--modules/indexer/issues/util.go4
2 files changed, 17 insertions, 35 deletions
diff --git a/modules/indexer/issues/internal/tests/tests.go b/modules/indexer/issues/internal/tests/tests.go
index 91aafd589c..2209377c2f 100644
--- a/modules/indexer/issues/internal/tests/tests.go
+++ b/modules/indexer/issues/internal/tests/tests.go
@@ -515,10 +515,8 @@ var cases = []*testIndexerCase{
{
Name: "SortByCreatedDesc",
SearchOptions: &internal.SearchOptions{
- Paginator: &db.ListOptions{
- ListAll: true,
- },
- SortBy: internal.SortByCreatedDesc,
+ Paginator: &db.ListOptionsAll,
+ SortBy: internal.SortByCreatedDesc,
},
Expected: func(t *testing.T, data map[int64]*internal.IndexerData, result *internal.SearchResult) {
assert.Equal(t, len(data), len(result.Hits))
@@ -533,10 +531,8 @@ var cases = []*testIndexerCase{
{
Name: "SortByUpdatedDesc",
SearchOptions: &internal.SearchOptions{
- Paginator: &db.ListOptions{
- ListAll: true,
- },
- SortBy: internal.SortByUpdatedDesc,
+ Paginator: &db.ListOptionsAll,
+ SortBy: internal.SortByUpdatedDesc,
},
Expected: func(t *testing.T, data map[int64]*internal.IndexerData, result *internal.SearchResult) {
assert.Equal(t, len(data), len(result.Hits))
@@ -551,10 +547,8 @@ var cases = []*testIndexerCase{
{
Name: "SortByCommentsDesc",
SearchOptions: &internal.SearchOptions{
- Paginator: &db.ListOptions{
- ListAll: true,
- },
- SortBy: internal.SortByCommentsDesc,
+ Paginator: &db.ListOptionsAll,
+ SortBy: internal.SortByCommentsDesc,
},
Expected: func(t *testing.T, data map[int64]*internal.IndexerData, result *internal.SearchResult) {
assert.Equal(t, len(data), len(result.Hits))
@@ -569,10 +563,8 @@ var cases = []*testIndexerCase{
{
Name: "SortByDeadlineDesc",
SearchOptions: &internal.SearchOptions{
- Paginator: &db.ListOptions{
- ListAll: true,
- },
- SortBy: internal.SortByDeadlineDesc,
+ Paginator: &db.ListOptionsAll,
+ SortBy: internal.SortByDeadlineDesc,
},
Expected: func(t *testing.T, data map[int64]*internal.IndexerData, result *internal.SearchResult) {
assert.Equal(t, len(data), len(result.Hits))
@@ -587,10 +579,8 @@ var cases = []*testIndexerCase{
{
Name: "SortByCreatedAsc",
SearchOptions: &internal.SearchOptions{
- Paginator: &db.ListOptions{
- ListAll: true,
- },
- SortBy: internal.SortByCreatedAsc,
+ Paginator: &db.ListOptionsAll,
+ SortBy: internal.SortByCreatedAsc,
},
Expected: func(t *testing.T, data map[int64]*internal.IndexerData, result *internal.SearchResult) {
assert.Equal(t, len(data), len(result.Hits))
@@ -605,10 +595,8 @@ var cases = []*testIndexerCase{
{
Name: "SortByUpdatedAsc",
SearchOptions: &internal.SearchOptions{
- Paginator: &db.ListOptions{
- ListAll: true,
- },
- SortBy: internal.SortByUpdatedAsc,
+ Paginator: &db.ListOptionsAll,
+ SortBy: internal.SortByUpdatedAsc,
},
Expected: func(t *testing.T, data map[int64]*internal.IndexerData, result *internal.SearchResult) {
assert.Equal(t, len(data), len(result.Hits))
@@ -623,10 +611,8 @@ var cases = []*testIndexerCase{
{
Name: "SortByCommentsAsc",
SearchOptions: &internal.SearchOptions{
- Paginator: &db.ListOptions{
- ListAll: true,
- },
- SortBy: internal.SortByCommentsAsc,
+ Paginator: &db.ListOptionsAll,
+ SortBy: internal.SortByCommentsAsc,
},
Expected: func(t *testing.T, data map[int64]*internal.IndexerData, result *internal.SearchResult) {
assert.Equal(t, len(data), len(result.Hits))
@@ -641,10 +627,8 @@ var cases = []*testIndexerCase{
{
Name: "SortByDeadlineAsc",
SearchOptions: &internal.SearchOptions{
- Paginator: &db.ListOptions{
- ListAll: true,
- },
- SortBy: internal.SortByDeadlineAsc,
+ Paginator: &db.ListOptionsAll,
+ SortBy: internal.SortByDeadlineAsc,
},
Expected: func(t *testing.T, data map[int64]*internal.IndexerData, result *internal.SearchResult) {
assert.Equal(t, len(data), len(result.Hits))
diff --git a/modules/indexer/issues/util.go b/modules/indexer/issues/util.go
index 510b4060b2..9861c808dc 100644
--- a/modules/indexer/issues/util.go
+++ b/modules/indexer/issues/util.go
@@ -61,9 +61,7 @@ func getIssueIndexerData(ctx context.Context, issueID int64) (*internal.IndexerD
)
{
reviews, err := issue_model.FindReviews(ctx, issue_model.FindReviewOptions{
- ListOptions: db.ListOptions{
- ListAll: true,
- },
+ ListOptions: db.ListOptionsAll,
IssueID: issueID,
OfficialOnly: false,
})