Commit 542c19be authored by Kushal Pandya's avatar Kushal Pandya

Merge branch '356634-fix-create-issue-none-weight-board' into 'master'

Fix create issue in board with scope weight NONE

See merge request gitlab-org/gitlab!83568
parents 57161278 7222369f
...@@ -121,7 +121,7 @@ export function formatIssueInput(issueInput, boardConfig) { ...@@ -121,7 +121,7 @@ export function formatIssueInput(issueInput, boardConfig) {
: issueInput?.milestoneId, : issueInput?.milestoneId,
labelIds: [...labelIds, ...(labels?.map((l) => fullLabelId(l)) || [])], labelIds: [...labelIds, ...(labels?.map((l) => fullLabelId(l)) || [])],
assigneeIds: [...assigneeIds, ...(assigneeId ? [fullUserId(assigneeId)] : [])], assigneeIds: [...assigneeIds, ...(assigneeId ? [fullUserId(assigneeId)] : [])],
weight, weight: weight > -1 ? weight : undefined,
}; };
} }
......
import { formatIssueInput, filterVariables } from '~/boards/boards_util'; import { formatIssueInput, filterVariables } from '~/boards/boards_util';
describe('formatIssueInput', () => { describe('formatIssueInput', () => {
const issueInput = {
labelIds: ['gid://gitlab/GroupLabel/5'],
projectPath: 'gitlab-org/gitlab-test',
id: 'gid://gitlab/Issue/11',
};
it('correctly merges boardConfig into the issue', () => { it('correctly merges boardConfig into the issue', () => {
const boardConfig = { const boardConfig = {
labels: [ labels: [
...@@ -14,12 +20,6 @@ describe('formatIssueInput', () => { ...@@ -14,12 +20,6 @@ describe('formatIssueInput', () => {
weight: 1, weight: 1,
}; };
const issueInput = {
labelIds: ['gid://gitlab/GroupLabel/5'],
projectPath: 'gitlab-org/gitlab-test',
id: 'gid://gitlab/Issue/11',
};
const result = formatIssueInput(issueInput, boardConfig); const result = formatIssueInput(issueInput, boardConfig);
expect(result).toEqual({ expect(result).toEqual({
projectPath: 'gitlab-org/gitlab-test', projectPath: 'gitlab-org/gitlab-test',
...@@ -30,6 +30,23 @@ describe('formatIssueInput', () => { ...@@ -30,6 +30,23 @@ describe('formatIssueInput', () => {
weight: 1, weight: 1,
}); });
}); });
it('does not add weight to input if weight is NONE', () => {
const boardConfig = {
weight: -2, // NO_WEIGHT
};
const result = formatIssueInput(issueInput, boardConfig);
const expected = {
projectPath: 'gitlab-org/gitlab-test',
id: 'gid://gitlab/Issue/11',
labelIds: ['gid://gitlab/GroupLabel/5'],
assigneeIds: [],
milestoneId: undefined,
};
expect(result).toEqual(expected);
});
}); });
describe('filterVariables', () => { describe('filterVariables', () => {
......
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