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
59d7741d
Commit
59d7741d
authored
Oct 24, 2019
by
Patrick Derichs
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix graphql todo IDs
Also adding specs.
parent
7f936a16
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
43 additions
and
2 deletions
+43
-2
app/presenters/todo_presenter.rb
app/presenters/todo_presenter.rb
+0
-2
changelogs/unreleased/34850-fix-graphql-todo-ids.yml
changelogs/unreleased/34850-fix-graphql-todo-ids.yml
+5
-0
spec/requests/api/graphql/current_user/todos_query_spec.rb
spec/requests/api/graphql/current_user/todos_query_spec.rb
+38
-0
No files found.
app/presenters/todo_presenter.rb
View file @
59d7741d
# frozen_string_literal: true
class
TodoPresenter
<
Gitlab
::
View
::
Presenter
::
Delegated
include
GlobalID
::
Identification
presents
:todo
end
changelogs/unreleased/34850-fix-graphql-todo-ids.yml
0 → 100644
View file @
59d7741d
---
title
:
Fix Todo IDs in GraphQL API
merge_request
:
19068
author
:
type
:
fixed
spec/requests/api/graphql/current_user/todos_query_spec.rb
0 → 100644
View file @
59d7741d
# frozen_string_literal: true
require
'spec_helper'
describe
'Query current user todos'
do
include
GraphqlHelpers
let_it_be
(
:current_user
)
{
create
(
:user
)
}
let_it_be
(
:commit_todo
)
{
create
(
:on_commit_todo
,
user:
current_user
,
project:
create
(
:project
,
:repository
))
}
let_it_be
(
:issue_todo
)
{
create
(
:todo
,
user:
current_user
,
target:
create
(
:issue
))
}
let_it_be
(
:merge_request_todo
)
{
create
(
:todo
,
user:
current_user
,
target:
create
(
:merge_request
))
}
let
(
:fields
)
do
<<~
QUERY
nodes {
id
}
QUERY
end
let
(
:query
)
do
graphql_query_for
(
'currentUser'
,
{},
query_graphql_field
(
'todos'
,
{},
fields
))
end
subject
{
graphql_data
.
dig
(
'currentUser'
,
'todos'
,
'nodes'
)
}
before
do
post_graphql
(
query
,
current_user:
current_user
)
end
it
'contains the expected ids'
do
is_expected
.
to
include
(
a_hash_including
(
'id'
=>
commit_todo
.
to_global_id
.
to_s
),
a_hash_including
(
'id'
=>
issue_todo
.
to_global_id
.
to_s
),
a_hash_including
(
'id'
=>
merge_request_todo
.
to_global_id
.
to_s
)
)
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