Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'app/finders/boards/boards_finder.rb')
-rw-r--r--app/finders/boards/boards_finder.rb32
1 files changed, 32 insertions, 0 deletions
diff --git a/app/finders/boards/boards_finder.rb b/app/finders/boards/boards_finder.rb
new file mode 100644
index 00000000000..5b8c313a178
--- /dev/null
+++ b/app/finders/boards/boards_finder.rb
@@ -0,0 +1,32 @@
+# frozen_string_literal: true
+
+module Boards
+ class BoardsFinder < Boards::BaseService
+ def execute
+ find_boards
+ end
+
+ private
+
+ def boards
+ parent.boards.order_by_name_asc
+ end
+
+ def first_board
+ parent.boards.first_board
+ end
+
+ 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
+ end
+end