debian-mirror-gitlab/lib/learn_gitlab.rb

36 lines
598 B
Ruby
Raw Normal View History

2020-07-28 23:09:34 +05:30
# frozen_string_literal: true
class LearnGitlab
2021-04-29 21:17:54 +05:30
PROJECT_NAME = 'Learn GitLab'
BOARD_NAME = 'GitLab onboarding'
LABEL_NAME = 'Novice'
2020-07-28 23:09:34 +05:30
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