Commit 3bacba23 authored by Simon Knox's avatar Simon Knox

Merge branch '336071-creating-an-issue-should-add-board-scope-to-it' into 'master'

Fix create issue with scope

See merge request gitlab-org/gitlab!66217
parents a0746693 60c2beab
......@@ -107,8 +107,8 @@ export function formatIssueInput(issueInput, boardConfig) {
const { labels, assigneeId, milestoneId } = boardConfig;
return {
milestoneId: milestoneId ? fullMilestoneId(milestoneId) : null,
...issueInput,
milestoneId: milestoneId ? fullMilestoneId(milestoneId) : null,
labelIds: [...labelIds, ...(labels?.map((l) => fullLabelId(l)) || [])],
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', () => {
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