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
19a499e8
Commit
19a499e8
authored
Sep 15, 2020
by
Eugenia Grieff
Committed by
Nicolò Maria Mezzopera
Sep 15, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use full project path for issueMoveList mutation
parent
1922007e
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
50 additions
and
8 deletions
+50
-8
app/assets/javascripts/boards/stores/actions.js
app/assets/javascripts/boards/stores/actions.js
+2
-2
spec/frontend/boards/mock_data.js
spec/frontend/boards/mock_data.js
+6
-6
spec/frontend/boards/stores/actions_spec.js
spec/frontend/boards/stores/actions_spec.js
+42
-0
No files found.
app/assets/javascripts/boards/stores/actions.js
View file @
19a499e8
...
@@ -263,13 +263,13 @@ export default {
...
@@ -263,13 +263,13 @@ export default {
commit
(
types
.
MOVE_ISSUE
,
{
originalIssue
,
fromListId
,
toListId
,
moveBeforeId
,
moveAfterId
});
commit
(
types
.
MOVE_ISSUE
,
{
originalIssue
,
fromListId
,
toListId
,
moveBeforeId
,
moveAfterId
});
const
{
boardId
}
=
state
.
endpoints
;
const
{
boardId
}
=
state
.
endpoints
;
const
[
groupPath
,
project
]
=
issuePath
.
split
(
/
[/
#
]
/
);
const
[
fullProjectPath
]
=
issuePath
.
split
(
/
[
#
]
/
);
gqlClient
gqlClient
.
mutate
({
.
mutate
({
mutation
:
issueMoveListMutation
,
mutation
:
issueMoveListMutation
,
variables
:
{
variables
:
{
projectPath
:
`
${
groupPath
}
/
${
project
}
`
,
projectPath
:
fullProjectPath
,
boardId
:
fullBoardId
(
boardId
),
boardId
:
fullBoardId
(
boardId
),
iid
:
issueIid
,
iid
:
issueIid
,
fromListId
:
getIdFromGraphQLId
(
fromListId
),
fromListId
:
getIdFromGraphQLId
(
fromListId
),
...
...
spec/frontend/boards/mock_data.js
View file @
19a499e8
...
@@ -125,8 +125,8 @@ export const rawIssue = {
...
@@ -125,8 +125,8 @@ export const rawIssue = {
timeEstimate
:
0
,
timeEstimate
:
0
,
weight
:
null
,
weight
:
null
,
confidential
:
false
,
confidential
:
false
,
referencePath
:
'
gitlab-org/gitlab-test#27
'
,
referencePath
:
'
gitlab-org/
test-subgroup/
gitlab-test#27
'
,
path
:
'
/gitlab-org/gitlab-test/-/issues/27
'
,
path
:
'
/gitlab-org/
test-subgroup/
gitlab-test/-/issues/27
'
,
labels
:
{
labels
:
{
nodes
:
[
nodes
:
[
{
{
...
@@ -153,8 +153,8 @@ export const mockIssue = {
...
@@ -153,8 +153,8 @@ export const mockIssue = {
timeEstimate
:
0
,
timeEstimate
:
0
,
weight
:
null
,
weight
:
null
,
confidential
:
false
,
confidential
:
false
,
referencePath
:
'
gitlab-org/gitlab-test#27
'
,
referencePath
:
'
gitlab-org/
test-subgroup/
gitlab-test#27
'
,
path
:
'
/gitlab-org/gitlab-test/-/issues/27
'
,
path
:
'
/gitlab-org/
test-subgroup/
gitlab-test/-/issues/27
'
,
assignees
,
assignees
,
labels
:
[
labels
:
[
{
{
...
@@ -179,8 +179,8 @@ export const mockIssue2 = {
...
@@ -179,8 +179,8 @@ export const mockIssue2 = {
timeEstimate
:
0
,
timeEstimate
:
0
,
weight
:
null
,
weight
:
null
,
confidential
:
false
,
confidential
:
false
,
referencePath
:
'
gitlab-org/
gitlab-test#2
'
,
referencePath
:
'
gitlab-org/
test-subgroup/gitlab-test#28
'
,
path
:
'
/gitlab-org/gitlab-test/-/issues/28
'
,
path
:
'
/gitlab-org/
test-subgroup/
gitlab-test/-/issues/28
'
,
assignees
,
assignees
,
labels
,
labels
,
epic
:
{
epic
:
{
...
...
spec/frontend/boards/stores/actions_spec.js
View file @
19a499e8
...
@@ -10,6 +10,8 @@ import {
...
@@ -10,6 +10,8 @@ import {
import
actions
,
{
gqlClient
}
from
'
~/boards/stores/actions
'
;
import
actions
,
{
gqlClient
}
from
'
~/boards/stores/actions
'
;
import
*
as
types
from
'
~/boards/stores/mutation_types
'
;
import
*
as
types
from
'
~/boards/stores/mutation_types
'
;
import
{
inactiveId
,
ListType
}
from
'
~/boards/constants
'
;
import
{
inactiveId
,
ListType
}
from
'
~/boards/constants
'
;
import
issueMoveListMutation
from
'
~/boards/queries/issue_move_list.mutation.graphql
'
;
import
{
fullBoardId
}
from
'
~/boards/boards_util
'
;
const
expectNotImplemented
=
action
=>
{
const
expectNotImplemented
=
action
=>
{
it
(
'
is not implemented
'
,
()
=>
{
it
(
'
is not implemented
'
,
()
=>
{
...
@@ -17,6 +19,10 @@ const expectNotImplemented = action => {
...
@@ -17,6 +19,10 @@ const expectNotImplemented = action => {
});
});
};
};
// We need this helper to make sure projectPath is including
// subgroups when the movIssue action is called.
const
getProjectPath
=
path
=>
path
.
split
(
'
#
'
)[
0
];
describe
(
'
setInitialBoardData
'
,
()
=>
{
describe
(
'
setInitialBoardData
'
,
()
=>
{
it
(
'
sets data object
'
,
()
=>
{
it
(
'
sets data object
'
,
()
=>
{
const
mockData
=
{
const
mockData
=
{
...
@@ -290,6 +296,42 @@ describe('moveIssue', () => {
...
@@ -290,6 +296,42 @@ describe('moveIssue', () => {
);
);
});
});
it
(
'
calls mutate with the correct variables
'
,
()
=>
{
const
mutationVariables
=
{
mutation
:
issueMoveListMutation
,
variables
:
{
projectPath
:
getProjectPath
(
mockIssue
.
referencePath
),
boardId
:
fullBoardId
(
state
.
endpoints
.
boardId
),
iid
:
mockIssue
.
iid
,
fromListId
:
1
,
toListId
:
2
,
moveBeforeId
:
undefined
,
moveAfterId
:
undefined
,
},
};
jest
.
spyOn
(
gqlClient
,
'
mutate
'
).
mockResolvedValue
({
data
:
{
issueMoveList
:
{
issue
:
rawIssue
,
errors
:
[],
},
},
});
actions
.
moveIssue
(
{
state
,
commit
:
()
=>
{}
},
{
issueId
:
mockIssue
.
id
,
issueIid
:
mockIssue
.
iid
,
issuePath
:
mockIssue
.
referencePath
,
fromListId
:
'
gid://gitlab/List/1
'
,
toListId
:
'
gid://gitlab/List/2
'
,
},
);
expect
(
gqlClient
.
mutate
).
toHaveBeenCalledWith
(
mutationVariables
);
});
it
(
'
should commit MOVE_ISSUE mutation and MOVE_ISSUE_FAILURE mutation when unsuccessful
'
,
done
=>
{
it
(
'
should commit MOVE_ISSUE mutation and MOVE_ISSUE_FAILURE mutation when unsuccessful
'
,
done
=>
{
jest
.
spyOn
(
gqlClient
,
'
mutate
'
).
mockResolvedValue
({
jest
.
spyOn
(
gqlClient
,
'
mutate
'
).
mockResolvedValue
({
data
:
{
data
:
{
...
...
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