2018-12-05 23:21:45 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2016-09-13 17:45:13 +05:30
|
|
|
class Projects::BoardsController < Projects::ApplicationController
|
2019-09-30 21:07:59 +05:30
|
|
|
include MultipleBoardsActions
|
2016-11-03 12:29:30 +05:30
|
|
|
include IssuableCollections
|
2016-09-13 17:45:13 +05:30
|
|
|
|
2018-03-17 18:26:18 +05:30
|
|
|
before_action :check_issues_available!
|
2016-11-03 12:29:30 +05:30
|
|
|
before_action :authorize_read_board!, only: [:index, :show]
|
2018-03-17 18:26:18 +05:30
|
|
|
before_action :assign_endpoint_vars
|
2019-12-21 20:55:43 +05:30
|
|
|
before_action do
|
2021-02-22 17:27:13 +05:30
|
|
|
push_frontend_feature_flag(:add_issues_button)
|
2019-12-21 20:55:43 +05:30
|
|
|
end
|
2016-09-13 17:45:13 +05:30
|
|
|
|
2021-01-03 14:25:43 +05:30
|
|
|
feature_category :boards
|
|
|
|
|
2016-09-13 17:45:13 +05:30
|
|
|
private
|
|
|
|
|
2021-03-11 19:13:27 +05:30
|
|
|
def board_klass
|
|
|
|
Board
|
|
|
|
end
|
|
|
|
|
|
|
|
def boards_finder
|
|
|
|
strong_memoize :boards_finder do
|
2021-04-17 20:07:23 +05:30
|
|
|
Boards::BoardsFinder.new(parent, current_user)
|
2021-03-11 19:13:27 +05:30
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
def board_finder
|
|
|
|
strong_memoize :board_finder do
|
2021-04-17 20:07:23 +05:30
|
|
|
Boards::BoardsFinder.new(parent, current_user, board_id: params[:id])
|
2021-03-11 19:13:27 +05:30
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
def board_create_service
|
|
|
|
strong_memoize :board_create_service do
|
|
|
|
Boards::CreateService.new(parent, current_user)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2018-03-17 18:26:18 +05:30
|
|
|
def assign_endpoint_vars
|
|
|
|
@boards_endpoint = project_boards_path(project)
|
|
|
|
@bulk_issues_path = bulk_update_project_issues_path(project)
|
|
|
|
@namespace_path = project.namespace.full_path
|
|
|
|
@labels_endpoint = project_labels_path(project)
|
|
|
|
end
|
|
|
|
|
2016-09-13 17:45:13 +05:30
|
|
|
def authorize_read_board!
|
2021-04-17 20:07:23 +05:30
|
|
|
access_denied! unless can?(current_user, :read_issue_board, project)
|
2016-09-13 17:45:13 +05:30
|
|
|
end
|
|
|
|
end
|