Commit 60c2beab authored by Florie Guibert's avatar Florie Guibert

Fix create issue with scope

Fix adding milestone from board scope when creating a new issue on board
parent bd7f09e2
...@@ -107,8 +107,8 @@ export function formatIssueInput(issueInput, boardConfig) { ...@@ -107,8 +107,8 @@ export function formatIssueInput(issueInput, boardConfig) {
const { labels, assigneeId, milestoneId } = boardConfig; const { labels, assigneeId, milestoneId } = boardConfig;
return { return {
milestoneId: milestoneId ? fullMilestoneId(milestoneId) : null,
...issueInput, ...issueInput,
milestoneId: milestoneId ? fullMilestoneId(milestoneId) : null,
labelIds: [...labelIds, ...(labels?.map((l) => fullLabelId(l)) || [])], labelIds: [...labelIds, ...(labels?.map((l) => fullLabelId(l)) || [])],
assigneeIds: [...assigneeIds, ...(assigneeId ? [fullUserId(assigneeId)] : [])], assigneeIds: [...assigneeIds, ...(assigneeId ? [fullUserId(assigneeId)] : [])],
}; };
......
import { filterVariables } from '~/boards/boards_util'; import { formatIssueInput, filterVariables } from '~/boards/boards_util';
describe('formatIssueInput', () => {
it('correctly merges boardConfig into the issue', () => {
const boardConfig = {
labels: [
{
type: 'GroupLabel',
id: 44,
},
],
assigneeId: '55',
milestoneId: 66,
weight: 1,
};
const issueInput = {
labelIds: ['gid://gitlab/GroupLabel/5'],
projectPath: 'gitlab-org/gitlab-test',
id: 'gid://gitlab/Issue/11',
};
const result = formatIssueInput(issueInput, boardConfig);
expect(result).toEqual({
projectPath: 'gitlab-org/gitlab-test',
id: 'gid://gitlab/Issue/11',
labelIds: ['gid://gitlab/GroupLabel/5', 'gid://gitlab/GroupLabel/44'],
assigneeIds: ['gid://gitlab/User/55'],
milestoneId: 'gid://gitlab/Milestone/66',
});
});
});
describe('filterVariables', () => { describe('filterVariables', () => {
it.each([ it.each([
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment