Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
693d3c8d
Commit
693d3c8d
authored
Aug 06, 2020
by
charlie ablett
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use Keyset pagination
- Apply reviewer feedback
parent
0e825e45
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
10 additions
and
15 deletions
+10
-15
app/graphql/resolvers/board_list_issues_resolver.rb
app/graphql/resolvers/board_list_issues_resolver.rb
+1
-1
app/graphql/types/issuable_connection_type.rb
app/graphql/types/issuable_connection_type.rb
+1
-1
spec/graphql/resolvers/board_list_issues_resolver_spec.rb
spec/graphql/resolvers/board_list_issues_resolver_spec.rb
+4
-9
spec/requests/api/graphql/boards/board_list_issues_query_spec.rb
...quests/api/graphql/boards/board_list_issues_query_spec.rb
+4
-4
No files found.
app/graphql/resolvers/board_list_issues_resolver.rb
View file @
693d3c8d
...
@@ -9,7 +9,7 @@ module Resolvers
...
@@ -9,7 +9,7 @@ module Resolvers
def
resolve
(
**
args
)
def
resolve
(
**
args
)
# rubocop: disable CodeReuse/ActiveRecord
# rubocop: disable CodeReuse/ActiveRecord
service
=
Boards
::
Issues
::
ListService
.
new
(
list
.
board
.
resource_parent
,
context
[
:current_user
],
{
board_id:
list
.
board
.
id
,
id:
list
.
id
})
service
=
Boards
::
Issues
::
ListService
.
new
(
list
.
board
.
resource_parent
,
context
[
:current_user
],
{
board_id:
list
.
board
.
id
,
id:
list
.
id
})
Gitlab
::
Graphql
::
Pagination
::
OffsetActiveRecordRelationConnection
.
new
(
service
.
execute
)
service
.
execute
.
reorder
(
"issues.relative_position ASC, issues.id DESC"
)
# rubocop: enable CodeReuse/ActiveRecord
# rubocop: enable CodeReuse/ActiveRecord
end
end
end
end
...
...
app/graphql/types/issuable_connection_type.rb
View file @
693d3c8d
...
@@ -7,7 +7,7 @@ module Types
...
@@ -7,7 +7,7 @@ module Types
description:
'Total count of collection'
description:
'Total count of collection'
def
count
def
count
relation
=
object
.
items
.
reorder
(
nil
)
relation
=
object
.
items
if
relation
.
try
(
:group_values
)
&
.
present?
if
relation
.
try
(
:group_values
)
&
.
present?
relation
.
size
.
keys
.
size
relation
.
size
.
keys
.
size
...
...
spec/graphql/resolvers/board_list_issues_resolver_spec.rb
View file @
693d3c8d
...
@@ -20,17 +20,12 @@ RSpec.describe Resolvers::BoardListIssuesResolver do
...
@@ -20,17 +20,12 @@ RSpec.describe Resolvers::BoardListIssuesResolver do
# auth is handled by the parent object
# auth is handled by the parent object
context
'when authorized'
do
context
'when authorized'
do
let!
(
:list
)
{
create
(
:list
,
board:
board
,
label:
label
)
}
let!
(
:list
)
{
create
(
:list
,
board:
board
,
label:
label
)
}
let!
(
:issue1
)
{
create
(
:issue
,
project:
project
,
labels:
[
label
],
relative_position:
10
,
id:
44
)
}
let!
(
:issue2
)
{
create
(
:issue
,
project:
project
,
labels:
[
label
],
relative_position:
12
,
id:
45
)
}
let!
(
:issue3
)
{
create
(
:issue
,
project:
project
,
labels:
[
label
],
relative_position:
10
,
id:
46
)
}
it
'calls Boards::Issues::ListService with the correct arguments'
do
expect
(
Boards
::
Issues
::
ListService
).
to
receive
(
:new
).
with
(
board_parent
,
user
,
{
board_id:
board
.
id
,
id:
list
.
id
}).
and_call_original
resolve_board_list_issues
end
it
'returns the issues in the correct order'
do
it
'returns the issues in the correct order'
do
issue1
=
create
(
:issue
,
project:
project
,
labels:
[
label
],
relative_position:
10
)
issue2
=
create
(
:issue
,
project:
project
,
labels:
[
label
],
relative_position:
12
)
issue3
=
create
(
:issue
,
project:
project
,
labels:
[
label
],
relative_position:
10
)
# by relative_position and then ID
# by relative_position and then ID
issues
=
resolve_board_list_issues
issues
=
resolve_board_list_issues
...
...
spec/requests/api/graphql/boards/board_list_issues_query_spec.rb
View file @
693d3c8d
...
@@ -51,10 +51,10 @@ RSpec.describe 'get board lists' do
...
@@ -51,10 +51,10 @@ RSpec.describe 'get board lists' do
shared_examples
'group and project board list issues query'
do
shared_examples
'group and project board list issues query'
do
let!
(
:board
)
{
create
(
:board
,
resource_parent:
board_parent
)
}
let!
(
:board
)
{
create
(
:board
,
resource_parent:
board_parent
)
}
let!
(
:label_list
)
{
create
(
:list
,
board:
board
,
label:
label
,
position:
10
)
}
let!
(
:label_list
)
{
create
(
:list
,
board:
board
,
label:
label
,
position:
10
)
}
let!
(
:issue1
)
{
create
(
:issue
,
project:
issue_project
,
labels:
[
label
],
relative_position:
9
,
id:
10
)
}
let!
(
:issue1
)
{
create
(
:issue
,
project:
issue_project
,
labels:
[
label
],
relative_position:
9
)
}
let!
(
:issue2
)
{
create
(
:issue
,
project:
issue_project
,
labels:
[
label
],
relative_position:
2
,
id:
11
)
}
let!
(
:issue2
)
{
create
(
:issue
,
project:
issue_project
,
labels:
[
label
],
relative_position:
2
)
}
let!
(
:issue3
)
{
create
(
:issue
,
project:
issue_project
,
labels:
[
label
],
relative_position:
9
,
id:
12
)
}
let!
(
:issue3
)
{
create
(
:issue
,
project:
issue_project
,
labels:
[
label
],
relative_position:
9
)
}
let!
(
:issue4
)
{
create
(
:issue
,
project:
issue_project
,
labels:
[
label2
],
relative_position:
432
,
id:
13
)
}
let!
(
:issue4
)
{
create
(
:issue
,
project:
issue_project
,
labels:
[
label2
],
relative_position:
432
)
}
context
'when the user does not have access to the board'
do
context
'when the user does not have access to the board'
do
it
'returns nil'
do
it
'returns nil'
do
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment