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
4328f599
Commit
4328f599
authored
Aug 24, 2020
by
Sean Arnold
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move setting of parent to issuable finder
- use before_all in spec
parent
a93d7dae
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
26 additions
and
28 deletions
+26
-28
app/finders/issuable_finder.rb
app/finders/issuable_finder.rb
+22
-0
app/graphql/resolvers/issue_status_counts_resolver.rb
app/graphql/resolvers/issue_status_counts_resolver.rb
+1
-14
lib/gitlab/graphql/loaders/issuable_loader.rb
lib/gitlab/graphql/loaders/issuable_loader.rb
+3
-14
No files found.
app/finders/issuable_finder.rb
View file @
4328f599
...
...
@@ -204,8 +204,30 @@ class IssuableFinder
end
end
def
parent
=
(
obj
)
@parent
=
obj
end
def
parent_param
=
(
obj
)
@parent
=
obj
params
[
parent_param
]
=
parent
if
parent
end
def
parent_param
case
parent
when
Project
:project_id
when
Group
:group_id
else
raise
"Unexpected parent:
#{
parent
.
class
}
"
end
end
private
attr_reader
:parent
def
not_params
strong_memoize
(
:not_params
)
do
params_class
.
new
(
params
[
:not
].
dup
,
current_user
,
klass
).
tap
do
|
not_params
|
...
...
app/graphql/resolvers/issue_status_counts_resolver.rb
View file @
4328f599
...
...
@@ -7,21 +7,8 @@ module Resolvers
type
Types
::
IssueStatusCountsType
,
null:
true
def
continue_issue_resolve
(
parent
,
finder
,
**
args
)
finder
.
par
ams
[
parent_param
(
parent
)]
=
parent
if
parent
finder
.
par
ent_param
=
parent
apply_lookahead
(
Gitlab
::
IssuablesCountForState
.
new
(
finder
,
parent
))
end
private
def
parent_param
(
parent
)
case
parent
when
Project
:project_id
when
Group
:group_id
else
raise
"Unexpected type of parent:
#{
parent
.
class
}
. Must be Project or Group"
end
end
end
end
lib/gitlab/graphql/loaders/issuable_loader.rb
View file @
4328f599
...
...
@@ -15,6 +15,7 @@ module Gitlab
def
batching_find_all
(
&
with_query
)
if
issuable_finder
.
params
.
keys
==
[
'iids'
]
issuable_finder
.
parent
=
parent
batch_load_issuables
(
issuable_finder
.
params
[
:iids
],
with_query
)
else
post_process
(
find_all
,
with_query
)
...
...
@@ -22,24 +23,12 @@ module Gitlab
end
def
find_all
issuable_finder
.
params
[
parent_param
]
=
parent
if
parent
issuable_finder
.
parent_param
=
parent
if
parent
issuable_finder
.
execute
end
private
def
parent_param
case
parent
when
Project
:project_id
when
Group
:group_id
else
raise
"Unexpected parent:
#{
parent
.
class
}
"
end
end
def
post_process
(
query
,
with_query
)
if
with_query
with_query
.
call
(
query
)
...
...
@@ -56,7 +45,7 @@ module Gitlab
return
if
parent
.
nil?
BatchLoader
::
GraphQL
.
for
([
parent_param
,
iid
.
to_s
])
.
for
([
issuable_finder
.
parent_param
,
iid
.
to_s
])
.
batch
(
key:
batch_key
)
do
|
params
,
loader
,
args
|
batch_key
=
args
[
:key
]
user
=
batch_key
.
current_user
...
...
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