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
Show 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
def
edit_service_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
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
context
'when OncallRotation::UpdateService responds with success'
do
it
'returns the on-call rotation with no errors'
do
expect
(
resolve
).
to
match
(
oncall_rotation:
::
IncidentManagement
::
OncallRotation
.
last!
,
oncall_rotation:
rotation
.
reload
,
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
it
'adds the participant to the rotation'
do
...
...
ee/spec/requests/api/graphql/project/incident_management/update_rotation_spec.rb
View file @
b419173b
...
...
@@ -109,7 +109,7 @@ RSpec.describe 'getting Incident Management on-call shifts' do
context
'errors'
do
context
'user cannot be found'
do
let
(
:params
)
{
{
participants:
[
{
username:
'unknown'
}]
}
}
let
(
:params
)
{
{
participants:
[{
username:
'unknown'
}]
}
}
it
'raises an error'
do
resolve
...
...
@@ -129,7 +129,7 @@ RSpec.describe 'getting Incident Management on-call shifts' do
{
username:
participant
.
user
.
username
,
colorWeight:
'WEIGHT_500'
,
colorPalette:
'BLUE'
,
colorPalette:
'BLUE'
}
end
...
...
@@ -138,7 +138,7 @@ RSpec.describe 'getting Incident Management on-call shifts' do
{
username:
participant
.
user
.
username
,
colorWeight:
"WEIGHT_
#{
participant
.
color_weight
}
"
,
colorPalette:
participant
.
color_palette
.
upcase
,
colorPalette:
participant
.
color_palette
.
upcase
}
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