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
c0749f85
Commit
c0749f85
authored
Feb 21, 2020
by
charlieablett
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add feature flag
Without the feature flag, the DescendantCountService functionality is used instead
parent
cb5eb4d2
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
43 additions
and
91 deletions
+43
-91
app/graphql/gitlab_schema.rb
app/graphql/gitlab_schema.rb
+1
-1
app/models/issue.rb
app/models/issue.rb
+2
-0
ee/app/models/ee/epic.rb
ee/app/models/ee/epic.rb
+2
-0
ee/spec/requests/api/graphql/group/epic/epic_aggregate_query_spec.rb
...uests/api/graphql/group/epic/epic_aggregate_query_spec.rb
+38
-90
No files found.
app/graphql/gitlab_schema.rb
View file @
c0749f85
...
...
@@ -28,7 +28,7 @@ class GitlabSchema < GraphQL::Schema
default_max_page_size
100
lazy_resolve
Epics
::
LazyEpicAggregate
,
:epic_aggregate
lazy_resolve
::
Epics
::
LazyEpicAggregate
,
:epic_aggregate
class
<<
self
def
multiplex
(
queries
,
**
kwargs
)
...
...
app/models/issue.rb
View file @
c0749f85
...
...
@@ -74,6 +74,8 @@ class Issue < ApplicationRecord
scope
:public_only
,
->
{
where
(
confidential:
false
)
}
scope
:confidential_only
,
->
{
where
(
confidential:
true
)
}
scope
:counts_by_state
,
->
{
reorder
(
nil
).
group
(
:state_id
).
count
}
ignore_column
:state
,
remove_with:
'12.7'
,
remove_after:
'2019-12-22'
after_commit
:expire_etag_cache
,
unless: :importing?
...
...
ee/app/models/ee/epic.rb
View file @
c0749f85
...
...
@@ -102,6 +102,8 @@ module EE
scope
:start_date_inherited
,
->
{
where
(
start_date_is_fixed:
[
nil
,
false
])
}
scope
:due_date_inherited
,
->
{
where
(
due_date_is_fixed:
[
nil
,
false
])
}
scope
:counts_by_state
,
->
{
group
(
:state_id
).
count
}
MAX_HIERARCHY_DEPTH
=
5
def
etag_caching_enabled?
...
...
ee/spec/requests/api/graphql/group/epic/epic_aggregate_query_spec.rb
View file @
c0749f85
...
...
@@ -2,7 +2,7 @@
require
'spec_helper'
describe
'
E
pic aggregates (count and weight)'
do
describe
'
Query e
pic aggregates (count and weight)'
do
include
GraphqlHelpers
let_it_be
(
:current_user
)
{
create
(
:user
)
}
...
...
@@ -54,11 +54,6 @@ describe 'Epic aggregates (count and weight)' do
it_behaves_like
'a working graphql query'
context
'with feature flag enabled'
do
before
do
stub_feature_flags
(
unfiltered_epic_aggregates:
true
)
end
it
'returns the epic counts'
do
epic_count_result
=
{
"openedEpics"
=>
1
,
...
...
@@ -91,51 +86,4 @@ describe 'Epic aggregates (count and weight)' do
a_hash_including
(
'descendantWeightSum'
=>
a_hash_including
(
descendant_weight_result
))
)
end
end
context
'with feature flag disabled'
do
before
do
stub_feature_flags
(
unfiltered_epic_aggregates:
false
)
end
context
'when requesting counts'
do
let
(
:epic_aggregates_query
)
do
<<~
QUERY
nodes {
descendantCounts {
openedEpics
closedEpics
openedIssues
closedIssues
}
}
QUERY
end
it
'uses the DescendantCountService'
do
expect
(
Epics
::
DescendantCountService
).
to
receive
(
:new
)
post_graphql
(
query
,
current_user:
current_user
)
end
end
context
'when requesting weights'
do
let
(
:epic_aggregates_query
)
do
<<~
QUERY
nodes {
descendantWeightSum {
openedIssues
closedIssues
}
}
QUERY
end
it
'returns an error'
do
post_graphql
(
query
,
current_user:
current_user
)
expect_graphql_errors_to_include
/Field 'descendantWeightSum' doesn't exist on type 'Epic/
end
end
end
end
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