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
db34cfc7
Commit
db34cfc7
authored
Feb 01, 2021
by
Donald Cook
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Show graphql error on confidential mutation
Should have length 0 Added a test
parent
2a62b9da
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
2 deletions
+23
-2
app/assets/javascripts/notes/stores/actions.js
app/assets/javascripts/notes/stores/actions.js
+6
-2
spec/frontend/notes/stores/actions_spec.js
spec/frontend/notes/stores/actions_spec.js
+17
-0
No files found.
app/assets/javascripts/notes/stores/actions.js
View file @
db34cfc7
...
...
@@ -727,9 +727,13 @@ export const updateConfidentialityOnIssuable = (
})
.
then
(({
data
})
=>
{
const
{
issueSetConfidential
:
{
issue
},
issueSetConfidential
:
{
issue
,
errors
},
}
=
data
;
if
(
errors
?.
length
)
{
Flash
(
errors
[
0
],
'
alert
'
);
}
else
{
setConfidentiality
({
commit
},
issue
.
confidential
);
}
});
};
spec/frontend/notes/stores/actions_spec.js
View file @
db34cfc7
...
...
@@ -1276,6 +1276,7 @@ describe('Actions Notes Store', () => {
return
actions
.
updateConfidentialityOnIssuable
({
commit
:
commitSpy
,
state
,
getters
},
actionArgs
)
.
then
(()
=>
{
expect
(
Flash
).
not
.
toHaveBeenCalled
();
expect
(
commitSpy
).
toHaveBeenCalledWith
(
mutationTypes
.
SET_ISSUE_CONFIDENTIAL
,
confidential
,
...
...
@@ -1283,6 +1284,22 @@ describe('Actions Notes Store', () => {
});
});
});
describe
(
'
on user recoverable error
'
,
()
=>
{
it
(
'
sends the error to Flash
'
,
()
=>
{
const
error
=
'
error
'
;
jest
.
spyOn
(
utils
.
gqClient
,
'
mutate
'
)
.
mockResolvedValue
({
data
:
{
issueSetConfidential
:
{
errors
:
[
error
]
}
}
});
return
actions
.
updateConfidentialityOnIssuable
({
commit
:
()
=>
{},
state
,
getters
},
actionArgs
)
.
then
(()
=>
{
expect
(
Flash
).
toHaveBeenCalledWith
(
error
,
'
alert
'
);
});
});
});
});
describe
.
each
`
...
...
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