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
9850207b
Commit
9850207b
authored
Mar 18, 2020
by
Natalia Tepluhina
Committed by
Martin Wortschack
Mar 18, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Ensure all mutations have 'errors' field and a proper handler
parent
250c86ea
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
14 additions
and
5 deletions
+14
-5
app/assets/javascripts/sidebar/queries/updateStatus.mutation.graphql
...javascripts/sidebar/queries/updateStatus.mutation.graphql
+3
-2
app/assets/javascripts/snippets/components/snippet_header.vue
...assets/javascripts/snippets/components/snippet_header.vue
+4
-1
ee/app/assets/javascripts/sidebar/sidebar_mediator.js
ee/app/assets/javascripts/sidebar/sidebar_mediator.js
+6
-1
spec/frontend/snippets/components/snippet_header_spec.js
spec/frontend/snippets/components/snippet_header_spec.js
+1
-1
No files found.
app/assets/javascripts/sidebar/queries/updateStatus.mutation.graphql
View file @
9850207b
mutation
(
$projectPath
:
ID
!,
$iid
:
String
!,
$healthStatus
:
HealthStatus
)
{
mutation
(
$projectPath
:
ID
!,
$iid
:
String
!,
$healthStatus
:
HealthStatus
)
{
updateIssue
(
input
:
{
projectPath
:
$projectPath
,
iid
:
$iid
,
healthStatus
:
$healthStatus
})
{
updateIssue
(
input
:
{
projectPath
:
$projectPath
,
iid
:
$iid
,
healthStatus
:
$healthStatus
})
{
issue
{
issue
{
healthStatus
healthStatus
}
}
errors
}
}
}
}
app/assets/javascripts/snippets/components/snippet_header.vue
View file @
9850207b
...
@@ -137,7 +137,10 @@ export default {
...
@@ -137,7 +137,10 @@ export default {
mutation
:
DeleteSnippetMutation
,
mutation
:
DeleteSnippetMutation
,
variables
:
{
id
:
this
.
snippet
.
id
},
variables
:
{
id
:
this
.
snippet
.
id
},
})
})
.
then
(()
=>
{
.
then
(({
data
})
=>
{
if
(
data
?.
destroySnippet
?.
errors
)
{
throw
new
Error
(
data
?.
destroySnippet
?.
errors
[
0
]);
}
this
.
isDeleting
=
false
;
this
.
isDeleting
=
false
;
this
.
errorMessage
=
undefined
;
this
.
errorMessage
=
undefined
;
this
.
closeDeleteModal
();
this
.
closeDeleteModal
();
...
...
ee/app/assets/javascripts/sidebar/sidebar_mediator.js
View file @
9850207b
...
@@ -33,7 +33,12 @@ export default class SidebarMediator extends CESidebarMediator {
...
@@ -33,7 +33,12 @@ export default class SidebarMediator extends CESidebarMediator {
this
.
store
.
setFetchingState
(
'
status
'
,
true
);
this
.
store
.
setFetchingState
(
'
status
'
,
true
);
return
this
.
service
return
this
.
service
.
updateWithGraphQl
(
updateStatusMutation
,
{
healthStatus
})
.
updateWithGraphQl
(
updateStatusMutation
,
{
healthStatus
})
.
then
(({
data
})
=>
this
.
store
.
setStatus
(
data
?.
updateIssue
?.
issue
?.
healthStatus
))
.
then
(({
data
})
=>
{
if
(
data
?.
updateIssue
?.
errors
?.
length
>
0
)
{
throw
data
.
updateIssue
.
errors
[
0
];
}
this
.
store
.
setStatus
(
data
?.
updateIssue
?.
issue
?.
healthStatus
);
})
.
catch
(
error
=>
{
.
catch
(
error
=>
{
throw
error
;
throw
error
;
})
})
...
...
spec/frontend/snippets/components/snippet_header_spec.js
View file @
9850207b
...
@@ -32,7 +32,7 @@ describe('Snippet header component', () => {
...
@@ -32,7 +32,7 @@ describe('Snippet header component', () => {
const
errorMsg
=
'
Foo bar
'
;
const
errorMsg
=
'
Foo bar
'
;
const
err
=
{
message
:
errorMsg
};
const
err
=
{
message
:
errorMsg
};
const
resolveMutate
=
jest
.
fn
(()
=>
Promise
.
resolve
());
const
resolveMutate
=
jest
.
fn
(()
=>
Promise
.
resolve
(
{
data
:
{}
}
));
const
rejectMutation
=
jest
.
fn
(()
=>
Promise
.
reject
(
err
));
const
rejectMutation
=
jest
.
fn
(()
=>
Promise
.
reject
(
err
));
const
mutationTypes
=
{
const
mutationTypes
=
{
...
...
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