2021-04-30 08:12:30 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
module LearnGitlab
|
|
|
|
class Project
|
|
|
|
PROJECT_NAME = 'Learn GitLab'
|
2022-02-01 13:17:05 -05:00
|
|
|
PROJECT_NAME_ULTIMATE_TRIAL = 'Learn GitLab - Ultimate trial'
|
2021-04-30 08:12:30 -04:00
|
|
|
BOARD_NAME = 'GitLab onboarding'
|
|
|
|
LABEL_NAME = 'Novice'
|
|
|
|
|
|
|
|
def initialize(current_user)
|
|
|
|
@current_user = current_user
|
|
|
|
end
|
|
|
|
|
|
|
|
def available?
|
|
|
|
project && board && label
|
|
|
|
end
|
|
|
|
|
|
|
|
def project
|
2022-02-01 13:17:05 -05:00
|
|
|
@project ||= current_user.projects.find_by_name([PROJECT_NAME, PROJECT_NAME_ULTIMATE_TRIAL])
|
2021-04-30 08:12:30 -04:00
|
|
|
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
|