2019-02-26 12:26:26 -05:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
module BoardsActions
|
|
|
|
include Gitlab::Utils::StrongMemoize
|
|
|
|
extend ActiveSupport::Concern
|
|
|
|
|
|
|
|
included do
|
|
|
|
include BoardsResponses
|
|
|
|
|
|
|
|
before_action :boards, only: :index
|
|
|
|
before_action :board, only: :show
|
2019-12-16 01:07:34 -05:00
|
|
|
before_action :push_wip_limits, only: [:index, :show]
|
2020-05-15 20:08:12 -04:00
|
|
|
before_action do
|
|
|
|
push_frontend_feature_flag(:not_issuable_queries, parent, default_enabled: true)
|
|
|
|
end
|
2019-02-26 12:26:26 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
def index
|
|
|
|
respond_with_boards
|
|
|
|
end
|
|
|
|
|
|
|
|
def show
|
|
|
|
# Add / update the board in the recent visits table
|
|
|
|
Boards::Visits::CreateService.new(parent, current_user).execute(board) if request.format.html?
|
|
|
|
|
|
|
|
respond_with_board
|
|
|
|
end
|
|
|
|
|
|
|
|
private
|
|
|
|
|
2019-11-21 01:06:32 -05:00
|
|
|
# Noop on FOSS
|
|
|
|
def push_wip_limits
|
|
|
|
end
|
|
|
|
|
2019-02-26 12:26:26 -05:00
|
|
|
def boards
|
|
|
|
strong_memoize(:boards) do
|
|
|
|
Boards::ListService.new(parent, current_user).execute
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
def board
|
|
|
|
strong_memoize(:board) do
|
|
|
|
boards.find(params[:id])
|
|
|
|
end
|
|
|
|
end
|
2019-06-06 04:13:18 -04:00
|
|
|
|
|
|
|
def serializer
|
|
|
|
BoardSerializer.new(current_user: current_user)
|
|
|
|
end
|
|
|
|
|
|
|
|
def serialize_as_json(resource)
|
|
|
|
serializer.represent(resource, serializer: 'board', include_full_project_path: board.group_board?)
|
|
|
|
end
|
2019-02-26 12:26:26 -05:00
|
|
|
end
|
2019-09-13 09:26:31 -04:00
|
|
|
|
|
|
|
BoardsActions.prepend_if_ee('EE::BoardsActions')
|