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
8d4c9ea1
Commit
8d4c9ea1
authored
Oct 17, 2019
by
Felipe Artur
Committed by
Jan Provaznik
Oct 17, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Expose 'subscribed' for epics in GraphQL
Exposes subscribed attribute for epics in GraphQL
parent
5fee3ef6
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
29 additions
and
5 deletions
+29
-5
doc/api/graphql/reference/index.md
doc/api/graphql/reference/index.md
+1
-0
ee/app/graphql/types/epic_type.rb
ee/app/graphql/types/epic_type.rb
+6
-0
ee/app/presenters/epic_presenter.rb
ee/app/presenters/epic_presenter.rb
+5
-1
ee/changelogs/unreleased/issue_31913.yml
ee/changelogs/unreleased/issue_31913.yml
+5
-0
ee/spec/graphql/types/epic_type_spec.rb
ee/spec/graphql/types/epic_type_spec.rb
+3
-1
spec/graphql/types/notes/diff_position_type_spec.rb
spec/graphql/types/notes/diff_position_type_spec.rb
+1
-1
spec/support/matchers/graphql_matchers.rb
spec/support/matchers/graphql_matchers.rb
+8
-2
No files found.
doc/api/graphql/reference/index.md
View file @
8d4c9ea1
...
...
@@ -211,6 +211,7 @@ The API can be explored interactively using the [GraphiQL IDE](../index.md#graph
|
`relativePosition`
| Int | The relative position of the epic in the Epic tree |
|
`relationPath`
| String | |
|
`reference`
| String! | |
|
`subscribed`
| Boolean! | Boolean flag for whether the currently logged in user is subscribed to this epic |
### EpicIssue
...
...
ee/app/graphql/types/epic_type.rb
View file @
8d4c9ea1
...
...
@@ -58,6 +58,12 @@ module Types
argument
:full
,
GraphQL
::
BOOLEAN_TYPE
,
required:
false
,
default_value:
false
# rubocop:disable Graphql/Descriptions
end
field
:subscribed
,
GraphQL
::
BOOLEAN_TYPE
,
method: :subscribed?
,
null:
false
,
complexity:
5
,
description:
'Boolean flag for whether the currently logged in user is subscribed to this epic'
field
:issues
,
# rubocop:disable Graphql/Descriptions
Types
::
EpicIssueType
.
connection_type
,
null:
true
,
...
...
ee/app/presenters/epic_presenter.rb
View file @
8d4c9ea1
...
...
@@ -35,13 +35,17 @@ class EpicPresenter < Gitlab::View::Presenter::Delegated
end
end
def
subscribed?
epic
.
subscribed?
(
current_user
)
end
private
def
initial_data
{
labels:
epic
.
labels
,
participants:
participants
,
subscribed:
epic
.
subscribed?
(
current_user
)
subscribed:
subscribed?
}
end
...
...
ee/changelogs/unreleased/issue_31913.yml
0 → 100644
View file @
8d4c9ea1
---
title
:
Expose subscribed attribute for Epics in GraphQL
merge_request
:
18607
author
:
type
:
added
ee/spec/graphql/types/epic_type_spec.rb
View file @
8d4c9ea1
...
...
@@ -10,7 +10,7 @@ describe GitlabSchema.types['Epic'] do
due_date due_date_is_fixed due_date_fixed due_date_from_milestones
closed_at created_at updated_at children has_children has_issues
web_path web_url relation_path reference issues
user_permissions notes discussions relative_position
user_permissions notes discussions relative_position
subscribed
]
end
...
...
@@ -21,4 +21,6 @@ describe GitlabSchema.types['Epic'] do
it
{
expect
(
described_class
).
to
require_graphql_authorizations
(
:read_epic
)
}
it
{
expect
(
described_class
).
to
have_graphql_fields
(
fields
)
}
it
{
is_expected
.
to
have_graphql_field
(
:subscribed
,
complexity:
5
)
}
end
spec/graphql/types/notes/diff_position_type_spec.rb
View file @
8d4c9ea1
...
...
@@ -7,6 +7,6 @@ describe GitlabSchema.types['DiffPosition'] do
:new_path
,
:position_type
,
:old_line
,
:new_line
,
:x
,
:y
,
:width
,
:height
]
is_expected
.
to
have_graphql_field
(
*
expected_fields
)
is_expected
.
to
have_graphql_field
s
(
*
expected_fields
)
end
end
spec/support/matchers/graphql_matchers.rb
View file @
8d4c9ea1
...
...
@@ -28,9 +28,15 @@ RSpec::Matchers.define :have_graphql_fields do |*expected|
end
end
RSpec
::
Matchers
.
define
:have_graphql_field
do
|
field_name
|
RSpec
::
Matchers
.
define
:have_graphql_field
do
|
field_name
,
args
=
{}
|
match
do
|
kls
|
expect
(
kls
.
fields
.
keys
).
to
include
(
GraphqlHelpers
.
fieldnamerize
(
field_name
))
field
=
kls
.
fields
[
GraphqlHelpers
.
fieldnamerize
(
field_name
)]
expect
(
field
).
to
be_present
args
.
each
do
|
argument
,
value
|
expect
(
field
.
send
(
argument
)).
to
eq
(
value
)
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