diff options
author | Douglas Barbosa Alexandre <dbalexandre@gmail.com> | 2016-09-19 17:34:27 -0300 |
---|---|---|
committer | Douglas Barbosa Alexandre <dbalexandre@gmail.com> | 2016-10-19 14:58:24 -0200 |
commit | bf9d928b45516e716b0f7f099361ca03aa1454f8 (patch) | |
tree | ae76a1a61ecca3f55694c108c97a94610e499435 /app | |
parent | 398ab263fd08a5d9d7b19c5b3d06f33814a474eb (diff) | |
download | gitlab-ce-bf9d928b45516e716b0f7f099361ca03aa1454f8.tar.gz |
Allow user to create a board list based on a group label
Diffstat (limited to 'app')
-rw-r--r-- | app/controllers/projects/issues_controller.rb | 5 | ||||
-rw-r--r-- | app/services/boards/lists/create_service.rb | 6 |
2 files changed, 9 insertions, 2 deletions
diff --git a/app/controllers/projects/issues_controller.rb b/app/controllers/projects/issues_controller.rb index d85bc85092f..4f6d7ca80df 100644 --- a/app/controllers/projects/issues_controller.rb +++ b/app/controllers/projects/issues_controller.rb @@ -25,7 +25,10 @@ class Projects::IssuesController < Projects::ApplicationController def index @issues = issues_collection @issues = @issues.page(params[:page]) - @labels = LabelsFinder.new(current_user, project_id: @project.id, title: params[:label_name]).execute if params[:label_name].presence + + if params[:label_name].presence + @labels = LabelsFinder.new(current_user, project_id: @project.id, title: params[:label_name]).execute + end respond_to do |format| format.html diff --git a/app/services/boards/lists/create_service.rb b/app/services/boards/lists/create_service.rb index abc7aeece39..fe0d762ccd2 100644 --- a/app/services/boards/lists/create_service.rb +++ b/app/services/boards/lists/create_service.rb @@ -3,7 +3,7 @@ module Boards class CreateService < BaseService def execute(board) List.transaction do - label = project.labels.find(params[:label_id]) + label = available_labels.find(params[:label_id]) position = next_position(board) create_list(board, label, position) @@ -12,6 +12,10 @@ module Boards private + def available_labels + LabelsFinder.new(current_user, project_id: project.id).execute + end + def next_position(board) max_position = board.lists.movable.maximum(:position) max_position.nil? ? 0 : max_position.succ |