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
b419173b
Commit
b419173b
authored
Mar 10, 2021
by
Sean Arnold
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix bugs with updating nested params
- Fix styling
parent
aec25187
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
22 additions
and
6 deletions
+22
-6
ee/app/graphql/mutations/incident_management/oncall_rotation/update.rb
...l/mutations/incident_management/oncall_rotation/update.rb
+13
-1
ee/spec/graphql/mutations/incident_management/oncall_rotation/update_spec.rb
...ations/incident_management/oncall_rotation/update_spec.rb
+5
-1
ee/spec/requests/api/graphql/project/incident_management/update_rotation_spec.rb
...aphql/project/incident_management/update_rotation_spec.rb
+4
-4
No files found.
ee/app/graphql/mutations/incident_management/oncall_rotation/update.rb
View file @
b419173b
...
@@ -54,7 +54,19 @@ module Mutations
...
@@ -54,7 +54,19 @@ module Mutations
def
edit_service_params
(
schedule
,
participants
,
args
)
def
edit_service_params
(
schedule
,
participants
,
args
)
parsed_service_params
=
parsed_params
(
schedule
,
participants
,
args
)
parsed_service_params
=
parsed_params
(
schedule
,
participants
,
args
)
args
.
slice
(
:name
).
merge
(
parsed_service_params
.
slice
(
*
args
.
keys
))
args_to_update
=
parsed_service_params
.
slice
(
*
args
.
keys
)
if
args
[
:rotation_length
]
args_to_update
[
:length
]
=
parsed_service_params
[
:length
]
args_to_update
[
:length_unit
]
=
parsed_service_params
[
:length_unit
]
end
if
args
[
:active_period
]
args_to_update
[
:active_period_start
]
=
parsed_service_params
[
:active_period_start
]
args_to_update
[
:active_period_end
]
=
parsed_service_params
[
:active_period_end
]
end
args
.
slice
(
:name
).
merge
(
args_to_update
)
end
end
def
find_object
(
id
:)
def
find_object
(
id
:)
...
...
ee/spec/graphql/mutations/incident_management/oncall_rotation/update_spec.rb
View file @
b419173b
...
@@ -38,9 +38,13 @@ RSpec.describe Mutations::IncidentManagement::OncallRotation::Update do
...
@@ -38,9 +38,13 @@ RSpec.describe Mutations::IncidentManagement::OncallRotation::Update do
context
'when OncallRotation::UpdateService responds with success'
do
context
'when OncallRotation::UpdateService responds with success'
do
it
'returns the on-call rotation with no errors'
do
it
'returns the on-call rotation with no errors'
do
expect
(
resolve
).
to
match
(
expect
(
resolve
).
to
match
(
oncall_rotation:
::
IncidentManagement
::
OncallRotation
.
last!
,
oncall_rotation:
rotation
.
reload
,
errors:
be_empty
errors:
be_empty
)
)
expect
(
rotation
).
to
have_attributes
(
args
.
except
(
:participants
,
:rotation_length
))
expect
(
rotation
.
length
).
to
eq
(
args
[
:rotation_length
][
:length
])
expect
(
rotation
.
length_unit
).
to
eq
(
IncidentManagement
::
OncallRotation
.
length_units
.
key
(
args
[
:rotation_length
][
:unit
]))
end
end
it
'adds the participant to the rotation'
do
it
'adds the participant to the rotation'
do
...
...
ee/spec/requests/api/graphql/project/incident_management/update_rotation_spec.rb
View file @
b419173b
...
@@ -48,7 +48,7 @@ RSpec.describe 'getting Incident Management on-call shifts' do
...
@@ -48,7 +48,7 @@ RSpec.describe 'getting Incident Management on-call shifts' do
subject
(
:resolve
)
{
post_graphql_mutation
(
mutation
,
current_user:
current_user
)
}
subject
(
:resolve
)
{
post_graphql_mutation
(
mutation
,
current_user:
current_user
)
}
def
mutation_response
def
mutation_response
graphql_mutation_response
(
:oncall_rotation_update
)
graphql_mutation_response
(
:oncall_rotation_update
)
end
end
context
'updating name only'
do
context
'updating name only'
do
...
@@ -109,7 +109,7 @@ RSpec.describe 'getting Incident Management on-call shifts' do
...
@@ -109,7 +109,7 @@ RSpec.describe 'getting Incident Management on-call shifts' do
context
'errors'
do
context
'errors'
do
context
'user cannot be found'
do
context
'user cannot be found'
do
let
(
:params
)
{
{
participants:
[
{
username:
'unknown'
}]
}
}
let
(
:params
)
{
{
participants:
[{
username:
'unknown'
}]
}
}
it
'raises an error'
do
it
'raises an error'
do
resolve
resolve
...
@@ -129,7 +129,7 @@ RSpec.describe 'getting Incident Management on-call shifts' do
...
@@ -129,7 +129,7 @@ RSpec.describe 'getting Incident Management on-call shifts' do
{
{
username:
participant
.
user
.
username
,
username:
participant
.
user
.
username
,
colorWeight:
'WEIGHT_500'
,
colorWeight:
'WEIGHT_500'
,
colorPalette:
'BLUE'
,
colorPalette:
'BLUE'
}
}
end
end
...
@@ -138,7 +138,7 @@ RSpec.describe 'getting Incident Management on-call shifts' do
...
@@ -138,7 +138,7 @@ RSpec.describe 'getting Incident Management on-call shifts' do
{
{
username:
participant
.
user
.
username
,
username:
participant
.
user
.
username
,
colorWeight:
"WEIGHT_
#{
participant
.
color_weight
}
"
,
colorWeight:
"WEIGHT_
#{
participant
.
color_weight
}
"
,
colorPalette:
participant
.
color_palette
.
upcase
,
colorPalette:
participant
.
color_palette
.
upcase
}
}
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