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

list_service.rb « boards « services « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 80ceb91f56d0a83db06a30e87f8baa882fae6c82 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# frozen_string_literal: true

module Boards
  class ListService < 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