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
254f78f5
Commit
254f78f5
authored
Jul 02, 2019
by
Luke Duncalfe
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Expose diff_refs on MergeRequestType
https://gitlab.com/gitlab-org/gitlab-ee/issues/9489
parent
a00a23ca
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
30 additions
and
11 deletions
+30
-11
app/graphql/types/diff_refs_type.rb
app/graphql/types/diff_refs_type.rb
+14
-0
app/graphql/types/merge_request_type.rb
app/graphql/types/merge_request_type.rb
+1
-0
app/graphql/types/notes/diff_position_base_input_type.rb
app/graphql/types/notes/diff_position_base_input_type.rb
+3
-3
app/graphql/types/notes/diff_position_type.rb
app/graphql/types/notes/diff_position_type.rb
+1
-6
spec/graphql/types/diff_refs_type_spec.rb
spec/graphql/types/diff_refs_type_spec.rb
+9
-0
spec/graphql/types/merge_request_type_spec.rb
spec/graphql/types/merge_request_type_spec.rb
+1
-1
spec/graphql/types/notes/diff_position_type_spec.rb
spec/graphql/types/notes/diff_position_type_spec.rb
+1
-1
No files found.
app/graphql/types/diff_refs_type.rb
0 → 100644
View file @
254f78f5
# frozen_string_literal: true
module
Types
# rubocop: disable Graphql/AuthorizeTypes
# Types that use DiffRefsType should have their own authorization
class
DiffRefsType
<
BaseObject
graphql_name
'DiffRefs'
field
:head_sha
,
GraphQL
::
STRING_TYPE
,
null:
false
,
description:
'The sha of the head at the time the comment was made'
field
:base_sha
,
GraphQL
::
STRING_TYPE
,
null:
false
,
description:
'The merge base of the branch the comment was made on'
field
:start_sha
,
GraphQL
::
STRING_TYPE
,
null:
false
,
description:
'The sha of the branch being compared against'
end
# rubocop: enable Graphql/AuthorizeTypes
end
app/graphql/types/merge_request_type.rb
View file @
254f78f5
...
...
@@ -23,6 +23,7 @@ module Types
field
:updated_at
,
Types
::
TimeType
,
null:
false
field
:source_project
,
Types
::
ProjectType
,
null:
true
field
:target_project
,
Types
::
ProjectType
,
null:
false
field
:diff_refs
,
Types
::
DiffRefsType
,
null:
true
# Alias for target_project
field
:project
,
Types
::
ProjectType
,
null:
false
field
:project_id
,
GraphQL
::
INT_TYPE
,
null:
false
,
method: :target_project_id
...
...
app/graphql/types/notes/diff_position_base_input_type.rb
View file @
254f78f5
...
...
@@ -5,11 +5,11 @@ module Types
# rubocop: disable Graphql/AuthorizeTypes
class
DiffPositionBaseInputType
<
BaseInputObject
argument
:head_sha
,
GraphQL
::
STRING_TYPE
,
required:
true
,
description:
copy_field_description
(
Types
::
Notes
::
DiffPosition
Type
,
:head_sha
)
description:
copy_field_description
(
Types
::
DiffRefs
Type
,
:head_sha
)
argument
:base_sha
,
GraphQL
::
STRING_TYPE
,
required:
false
,
description:
copy_field_description
(
Types
::
Notes
::
DiffPosition
Type
,
:base_sha
)
description:
copy_field_description
(
Types
::
DiffRefs
Type
,
:base_sha
)
argument
:start_sha
,
GraphQL
::
STRING_TYPE
,
required:
true
,
description:
copy_field_description
(
Types
::
Notes
::
DiffPosition
Type
,
:start_sha
)
description:
copy_field_description
(
Types
::
DiffRefs
Type
,
:start_sha
)
argument
:paths
,
Types
::
DiffPathsInputType
,
...
...
app/graphql/types/notes/diff_position_type.rb
View file @
254f78f5
...
...
@@ -7,12 +7,7 @@ module Types
class
DiffPositionType
<
BaseObject
graphql_name
'DiffPosition'
field
:head_sha
,
GraphQL
::
STRING_TYPE
,
null:
false
,
description:
"The sha of the head at the time the comment was made"
field
:base_sha
,
GraphQL
::
STRING_TYPE
,
null:
true
,
description:
"The merge base of the branch the comment was made on"
field
:start_sha
,
GraphQL
::
STRING_TYPE
,
null:
false
,
description:
"The sha of the branch being compared against"
field
:diff_refs
,
Types
::
DiffRefsType
,
null:
false
field
:file_path
,
GraphQL
::
STRING_TYPE
,
null:
false
,
description:
"The path of the file that was changed"
...
...
spec/graphql/types/diff_refs_type_spec.rb
0 → 100644
View file @
254f78f5
# frozen_string_literal: true
require
'spec_helper'
describe
GitlabSchema
.
types
[
'DiffRefs'
]
do
it
{
expect
(
described_class
.
graphql_name
).
to
eq
(
'DiffRefs'
)
}
it
{
expect
(
described_class
).
to
have_graphql_fields
(
:base_sha
,
:head_sha
,
:start_sha
)
}
end
spec/graphql/types/merge_request_type_spec.rb
View file @
254f78f5
...
...
@@ -13,7 +13,7 @@ describe GitlabSchema.types['MergeRequest'] do
description_html state created_at updated_at source_project target_project
project project_id source_project_id target_project_id source_branch
target_branch work_in_progress merge_when_pipeline_succeeds diff_head_sha
merge_commit_sha user_notes_count should_remove_source_branch
merge_commit_sha user_notes_count should_remove_source_branch
diff_refs
force_remove_source_branch merge_status in_progress_merge_commit_sha
merge_error allow_collaboration should_be_rebased rebase_commit_sha
rebase_in_progress merge_commit_message default_merge_commit_message
...
...
spec/graphql/types/notes/diff_position_type_spec.rb
View file @
254f78f5
...
...
@@ -3,7 +3,7 @@ require 'spec_helper'
describe
GitlabSchema
.
types
[
'DiffPosition'
]
do
it
'exposes the expected fields'
do
expected_fields
=
[
:
head_sha
,
:base_sha
,
:start_sha
,
:file_path
,
:old_path
,
expected_fields
=
[
:
diff_refs
,
:file_path
,
:old_path
,
:new_path
,
:position_type
,
:old_line
,
:new_line
,
:x
,
:y
,
:width
,
:height
]
...
...
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