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 'lib/learn_gitlab.rb')
-rw-r--r--lib/learn_gitlab.rb35
1 files changed, 35 insertions, 0 deletions
diff --git a/lib/learn_gitlab.rb b/lib/learn_gitlab.rb
new file mode 100644
index 00000000000..771083193d1
--- /dev/null
+++ b/lib/learn_gitlab.rb
@@ -0,0 +1,35 @@
+# frozen_string_literal: true
+
+class LearnGitlab
+ PROJECT_NAME = 'Learn GitLab'.freeze
+ BOARD_NAME = 'GitLab onboarding'.freeze
+ LABEL_NAME = 'Novice'.freeze
+
+ 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