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
14af1a8a
Commit
14af1a8a
authored
Aug 06, 2020
by
Sean Arnold
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Reuse common code in issues resolver
parent
967762f7
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
20 additions
and
28 deletions
+20
-28
app/graphql/resolvers/concerns/issue_resolver_fields.rb
app/graphql/resolvers/concerns/issue_resolver_fields.rb
+17
-0
app/graphql/resolvers/issue_status_counts_resolver.rb
app/graphql/resolvers/issue_status_counts_resolver.rb
+1
-14
app/graphql/resolvers/issues_resolver.rb
app/graphql/resolvers/issues_resolver.rb
+2
-14
No files found.
app/graphql/resolvers/concerns/issue_resolver_fields.rb
View file @
14af1a8a
...
...
@@ -49,6 +49,23 @@ module IssueResolverFields
required:
false
end
def
resolve
(
**
args
)
# The project could have been loaded in batch by `BatchLoader`.
# At this point we need the `id` of the project to query for issues, so
# make sure it's loaded and not `nil` before continuing.
parent
=
object
.
respond_to?
(
:sync
)
?
object
.
sync
:
object
return
Issue
.
none
if
parent
.
nil?
# Will need to be be made group & namespace aware with
# https://gitlab.com/gitlab-org/gitlab-foss/issues/54520
args
[
:iids
]
||=
[
args
.
delete
(
:iid
)].
compact
if
args
[
:iid
]
args
[
:attempt_project_search_optimizations
]
=
true
if
args
[
:search
].
present?
finder
=
IssuesFinder
.
new
(
current_user
,
args
)
continue_issue_resolve
(
parent
,
finder
,
**
args
)
end
class_methods
do
def
resolver_complexity
(
args
,
child_complexity
:)
complexity
=
super
...
...
app/graphql/resolvers/issue_status_counts_resolver.rb
View file @
14af1a8a
...
...
@@ -6,20 +6,7 @@ module Resolvers
type
Types
::
IssueStatusCountsType
,
null:
true
def
resolve
(
**
args
)
# The project could have been loaded in batch by `BatchLoader`.
# At this point we need the `id` of the project to query for issues, so
# make sure it's loaded and not `nil` before continuing.
parent
=
object
.
respond_to?
(
:sync
)
?
object
.
sync
:
object
return
Issue
.
none
if
parent
.
nil?
# Will need to be be made group & namespace aware with
# https://gitlab.com/gitlab-org/gitlab-foss/issues/54520
args
[
:iids
]
||=
[
args
.
delete
(
:iid
)].
compact
if
args
[
:iid
]
args
[
:attempt_project_search_optimizations
]
=
true
if
args
[
:search
].
present?
finder
=
IssuesFinder
.
new
(
current_user
,
args
)
def
continue_issue_resolve
(
parent
,
finder
,
**
args
)
Gitlab
::
IssuablesCountForState
.
new
(
finder
,
parent
)
end
end
...
...
app/graphql/resolvers/issues_resolver.rb
View file @
14af1a8a
...
...
@@ -2,7 +2,7 @@
module
Resolvers
class
IssuesResolver
<
BaseResolver
prepend
Resolvers
::
IssueResolverFields
prepend
IssueResolverFields
argument
:state
,
Types
::
IssuableStateEnum
,
required:
false
,
...
...
@@ -18,19 +18,7 @@ module Resolvers
label_priority_asc label_priority_desc
milestone_due_asc milestone_due_desc]
.
freeze
def
resolve
(
**
args
)
# The project could have been loaded in batch by `BatchLoader`.
# At this point we need the `id` of the project to query for issues, so
# make sure it's loaded and not `nil` before continuing.
parent
=
object
.
respond_to?
(
:sync
)
?
object
.
sync
:
object
return
Issue
.
none
if
parent
.
nil?
# Will need to be be made group & namespace aware with
# https://gitlab.com/gitlab-org/gitlab-foss/issues/54520
args
[
:iids
]
||=
[
args
.
delete
(
:iid
)].
compact
if
args
[
:iid
]
args
[
:attempt_project_search_optimizations
]
=
true
if
args
[
:search
].
present?
finder
=
IssuesFinder
.
new
(
current_user
,
args
)
def
continue_issue_resolve
(
parent
,
finder
,
**
args
)
issues
=
Gitlab
::
Graphql
::
Loaders
::
IssuableLoader
.
new
(
parent
,
finder
).
batching_find_all
if
non_stable_cursor_sort?
(
args
[
:sort
])
...
...
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