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 'app/helpers/learn_gitlab_helper.rb')
-rw-r--r--app/helpers/learn_gitlab_helper.rb66
1 files changed, 38 insertions, 28 deletions
diff --git a/app/helpers/learn_gitlab_helper.rb b/app/helpers/learn_gitlab_helper.rb
index 81896fb9fa4..a3a8a275f67 100644
--- a/app/helpers/learn_gitlab_helper.rb
+++ b/app/helpers/learn_gitlab_helper.rb
@@ -3,11 +3,21 @@
module LearnGitlabHelper
def learn_gitlab_experiment_enabled?(project)
return false unless current_user
- return false unless experiment_enabled_for_user?
+ return false unless continous_onboarding_experiment_enabled_for_user?
learn_gitlab_onboarding_available?(project)
end
+ def learn_gitlab_experiment_tracking_category
+ return unless current_user
+
+ if Gitlab::Experimentation.in_experiment_group?(:learn_gitlab_a, subject: current_user)
+ Gitlab::Experimentation.get_experiment(:learn_gitlab_a).tracking_category
+ elsif Gitlab::Experimentation.in_experiment_group?(:learn_gitlab_b, subject: current_user)
+ Gitlab::Experimentation.get_experiment(:learn_gitlab_b).tracking_category
+ end
+ end
+
def onboarding_actions_data(project)
attributes = onboarding_progress(project).attributes.symbolize_keys
@@ -21,42 +31,42 @@ module LearnGitlabHelper
end
end
- private
+ def continous_onboarding_experiment_enabled_for_user?
+ Gitlab::Experimentation.in_experiment_group?(:learn_gitlab_a, subject: current_user) ||
+ Gitlab::Experimentation.in_experiment_group?(:learn_gitlab_b, subject: current_user)
+ end
- ACTION_ISSUE_IDS = {
- issue_created: 4,
- git_write: 6,
- pipeline_created: 7,
- merge_request_created: 9,
- user_added: 8,
- trial_started: 2,
- required_mr_approvals_enabled: 11,
- code_owners_enabled: 10
- }.freeze
-
- ACTION_DOC_URLS = {
- security_scan_enabled: 'https://docs.gitlab.com/ee/user/application_security/security_dashboard/#gitlab-security-dashboard-security-center-and-vulnerability-reports'
- }.freeze
+ def onboarding_sections_data
+ {
+ workspace: {
+ svg: image_path("learn_gitlab/section_workspace.svg")
+ },
+ plan: {
+ svg: image_path("learn_gitlab/section_plan.svg")
+ },
+ deploy: {
+ svg: image_path("learn_gitlab/section_deploy.svg")
+ }
+ }
+ end
+
+ def learn_gitlab_onboarding_available?(project)
+ OnboardingProgress.onboarding?(project.namespace) &&
+ LearnGitlab::Project.new(current_user).available?
+ end
+
+ private
def action_urls
- ACTION_ISSUE_IDS.transform_values { |id| project_issue_url(learn_gitlab_project, id) }.merge(ACTION_DOC_URLS)
+ LearnGitlab::Onboarding::ACTION_ISSUE_IDS.transform_values { |id| project_issue_url(learn_gitlab_project, id) }
+ .merge(LearnGitlab::Onboarding::ACTION_DOC_URLS)
end
def learn_gitlab_project
- @learn_gitlab_project ||= LearnGitlab.new(current_user).project
+ @learn_gitlab_project ||= LearnGitlab::Project.new(current_user).project
end
def onboarding_progress(project)
OnboardingProgress.find_by(namespace: project.namespace) # rubocop: disable CodeReuse/ActiveRecord
end
-
- def experiment_enabled_for_user?
- Gitlab::Experimentation.in_experiment_group?(:learn_gitlab_a, subject: current_user) ||
- Gitlab::Experimentation.in_experiment_group?(:learn_gitlab_b, subject: current_user)
- end
-
- def learn_gitlab_onboarding_available?(project)
- OnboardingProgress.onboarding?(project.namespace) &&
- LearnGitlab.new(current_user).available?
- end
end