Commit 720dd410 authored by Simon Knox's avatar Simon Knox

Merge branch '2518-saved-configuration-for-issue-board' of...

Merge branch '2518-saved-configuration-for-issue-board' of gitlab.com:gitlab-org/gitlab-ee into 2518-saved-configuration-for-issue-board
parents 44c01ecc ada0c8ca
......@@ -19,7 +19,17 @@ module Boards
params.merge(label_ids: [list.label_id, *board.label_ids],
weight: board.weight,
milestone_id: board.milestone_id,
assignee_ids: [board.assignee_id])
assignee_ids: assignee_ids)
end
# This can be safely removed when the board
# receive multiple assignee support.
def assignee_ids
@board_assignee ||= board.assignee
return [] unless @board_assignee
[@board_assignee.id]
end
def board
......
......@@ -15,7 +15,8 @@ module EE
respond_to do |format|
format.json do
if board.valid?
render json: serialize_as_json(board)
extra_json = { board_path: board_path(board) }
render json: serialize_as_json(board).merge(extra_json)
else
render json: board.errors, status: :unprocessable_entity
end
......@@ -31,7 +32,8 @@ module EE
respond_to do |format|
format.json do
if @board.valid?
render json: serialize_as_json(@board)
extra_json = { board_path: board_path(@board) }
render json: serialize_as_json(@board).merge(extra_json)
else
render json: @board.errors, status: :unprocessable_entity
end
......@@ -75,6 +77,14 @@ module EE
end
end
def board_path(board)
if @group
group_board_path(parent, board)
else
project_board_path(parent, board)
end
end
def serialize_as_json(resource)
resource.as_json(
only: [:id, :name],
......
......@@ -63,8 +63,12 @@ describe Projects::BoardsController do
it 'valid board is created' do
create_board create_params
board = Board.first
expect(Board.count).to eq(1)
expect(Board.first).to have_attributes(create_params)
expect(board).to have_attributes(create_params.except(:assignee_id))
expect(board.assignee).to eq(user)
end
end
......
......@@ -7,6 +7,7 @@
"properties" : {
"id": { "type": "integer" },
"name": { "type": "string" },
"board_path": { "type": ["string", "null"] },
"milestone": {
"type": ["object", "null"],
"required": [
......
require 'spec_helper'
describe BoardFilterLabel do
describe BoardLabel do
describe 'validations' do
it { is_expected.to validate_presence_of(:board) }
it { is_expected.to validate_presence_of(:label) }
......
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