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

project.rb « learn_gitlab « lib - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 599f9940e53c692732341ed2b4fe2c9c536220a6 (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
33
34
35
36
37
# frozen_string_literal: true

module LearnGitlab
  class Project
    PROJECT_NAME = 'Learn GitLab'
    BOARD_NAME = 'GitLab onboarding'
    LABEL_NAME = 'Novice'

    def initialize(current_user)
      @current_user = current_user
    end

    def available?
      project && board && label
    end

    def project
      @project ||= current_user.projects.find_by_name(PROJECT_NAME)
    end

    def board
      return unless project

      @board ||= project.boards.find_by_name(BOARD_NAME)
    end

    def label
      return unless project

      @label ||= project.labels.find_by_name(LABEL_NAME)
    end

    private

    attr_reader :current_user
  end
end