Commit 0b40b275 authored by Douwe Maan's avatar Douwe Maan

Merge branch 'issue_7177' into 'master'

Fix error when creating issues in scoped boards

See merge request gitlab-org/gitlab-ee!11080
parents 6f31c3d0 94dbffe0
......@@ -13,14 +13,19 @@ module EE
milestone_id = list.milestone_id || board.milestone_id
options[:label_ids].concat(board.label_ids)
options[:weight] = board.weight if valid_weight?
options.merge!(
weight: board.weight,
milestone_id: milestone_id,
# This can be removed when boards have multiple assignee support.
# See https://gitlab.com/gitlab-org/gitlab-ee/issues/3786
assignee_ids: assignee_ids)
end
end
def valid_weight?
board.weight.present? && board.weight >= 0
end
end
end
end
......
---
title: Fix error when creating issues in scoped boards
merge_request: 11080
author:
type: fixed
......@@ -35,6 +35,37 @@ describe Boards::Issues::CreateService do
expect(issue.milestone).to eq(board_milestone)
expect(issue.labels).to contain_exactly(label, board_label)
end
context 'when board is scoped by weight' do
it 'creates issue weight 0 weight' do
board.update(weight: 0)
issue = service.execute
expect(issue.weight).to be_zero
expect(issue).to be_valid
end
it 'creates issue with nil weight' do
board.update(weight: nil)
issue = service.execute
expect(issue.weight).to be_nil
expect(issue).to be_valid
end
context 'when board weight is invalid' do
it 'creates issue with nil weight' do
board.update(weight: -1)
issue = service.execute
expect(issue.weight).to be_nil
expect(issue).to be_valid
end
end
end
end
context 'assignees list' do
......
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