2018-11-18 11:00:15 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2016-11-03 12:29:30 +05:30
|
|
|
module Boards
|
2021-04-17 20:07:23 +05:30
|
|
|
class BoardsFinder < Boards::BaseService
|
2021-03-11 19:13:27 +05:30
|
|
|
def execute
|
2020-03-13 15:44:24 +05:30
|
|
|
find_boards
|
2016-11-03 12:29:30 +05:30
|
|
|
end
|
|
|
|
|
|
|
|
private
|
|
|
|
|
2018-05-09 12:01:36 +05:30
|
|
|
def boards
|
2020-03-13 15:44:24 +05:30
|
|
|
parent.boards.order_by_name_asc
|
|
|
|
end
|
|
|
|
|
|
|
|
def first_board
|
|
|
|
parent.boards.first_board
|
2018-05-09 12:01:36 +05:30
|
|
|
end
|
|
|
|
|
2020-03-13 15:44:24 +05:30
|
|
|
def find_boards
|
|
|
|
found =
|
|
|
|
if parent.multiple_issue_boards_available?
|
|
|
|
boards
|
|
|
|
else
|
|
|
|
# When multiple issue boards are not available
|
|
|
|
# a user is only allowed to view the default shown board
|
|
|
|
first_board
|
|
|
|
end
|
|
|
|
|
|
|
|
params[:board_id].present? ? [found.find(params[:board_id])] : found
|
|
|
|
end
|
2016-11-03 12:29:30 +05:30
|
|
|
end
|
|
|
|
end
|