diff options
author | Felipe Artur <felipefac@gmail.com> | 2018-05-16 17:36:25 -0300 |
---|---|---|
committer | Felipe Artur <felipefac@gmail.com> | 2018-05-22 15:04:20 -0300 |
commit | 97067682ec8f675c0ec5d2d904f9004976d93c50 (patch) | |
tree | 7240ba5b272c63eee0c78e889cfee44928a0e092 /app | |
parent | f8568baad50b415a5a923d149d9c7b15f9d064a7 (diff) | |
download | gitlab-ce-97067682ec8f675c0ec5d2d904f9004976d93c50.tar.gz |
CE backport - Allow viewing only one board when multiple issue boards is not enabledce_backport_issue_5128
Diffstat (limited to 'app')
-rw-r--r-- | app/controllers/groups/boards_controller.rb | 11 | ||||
-rw-r--r-- | app/controllers/projects/boards_controller.rb | 9 |
2 files changed, 14 insertions, 6 deletions
diff --git a/app/controllers/groups/boards_controller.rb b/app/controllers/groups/boards_controller.rb index 7c2016f0326..e892d1f8dbf 100644 --- a/app/controllers/groups/boards_controller.rb +++ b/app/controllers/groups/boards_controller.rb @@ -2,19 +2,24 @@ class Groups::BoardsController < Groups::ApplicationController include BoardsResponses before_action :assign_endpoint_vars + before_action :boards, only: :index def index - @boards = Boards::ListService.new(group, current_user).execute - respond_with_boards end def show - @board = group.boards.find(params[:id]) + @board = boards.find(params[:id]) respond_with_board end + private + + def boards + @boards ||= Boards::ListService.new(group, current_user).execute + end + def assign_endpoint_vars @boards_endpoint = group_boards_url(group) @namespace_path = group.to_param diff --git a/app/controllers/projects/boards_controller.rb b/app/controllers/projects/boards_controller.rb index 949e54ff819..e7354a9e1f7 100644 --- a/app/controllers/projects/boards_controller.rb +++ b/app/controllers/projects/boards_controller.rb @@ -4,22 +4,25 @@ class Projects::BoardsController < Projects::ApplicationController before_action :check_issues_available! before_action :authorize_read_board!, only: [:index, :show] + before_action :boards, only: :index before_action :assign_endpoint_vars def index - @boards = Boards::ListService.new(project, current_user).execute - respond_with_boards end def show - @board = project.boards.find(params[:id]) + @board = boards.find(params[:id]) respond_with_board end private + def boards + @boards ||= Boards::ListService.new(project, current_user).execute + end + def assign_endpoint_vars @boards_endpoint = project_boards_path(project) @bulk_issues_path = bulk_update_project_issues_path(project) |