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:
authorGitLab Bot <gitlab-bot@gitlab.com>2023-01-30 18:10:44 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2023-01-30 18:10:44 +0300
commit412fe7ab5511ec446f250d415d571108fe838b68 (patch)
tree7070a49951bfb83ee22e963dc0c9a0a884900f29 /app/helpers
parent7cf8c080eda823e7e2577eeed1f96e168c37ee8f (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/helpers')
-rw-r--r--app/helpers/invite_members_helper.rb10
-rw-r--r--app/helpers/learn_gitlab_helper.rb106
-rw-r--r--app/helpers/sidebars_helper.rb1
3 files changed, 4 insertions, 113 deletions
diff --git a/app/helpers/invite_members_helper.rb b/app/helpers/invite_members_helper.rb
index 6fad1346426..e986b56fde4 100644
--- a/app/helpers/invite_members_helper.rb
+++ b/app/helpers/invite_members_helper.rb
@@ -45,7 +45,7 @@ module InviteMembersHelper
full_path: source.full_path
}
- if show_invite_members_for_task?(source)
+ if current_user && show_invite_members_for_task?(source)
dataset.merge!(
tasks_to_be_done_options: tasks_to_be_done_options.to_json,
projects: projects_for_source(source).to_json,
@@ -71,11 +71,9 @@ module InviteMembersHelper
{}
end
- def show_invite_members_for_task?(source)
- return unless current_user
-
- invite_for_help_continuous_onboarding = source.is_a?(Project) && experiment(:invite_for_help_continuous_onboarding, namespace: source.namespace).assigned.name == 'candidate'
- params[:open_modal] == 'invite_members_for_task' || invite_for_help_continuous_onboarding
+ # Overridden in EE
+ def show_invite_members_for_task?(_source)
+ params[:open_modal] == 'invite_members_for_task'
end
def tasks_to_be_done_options
diff --git a/app/helpers/learn_gitlab_helper.rb b/app/helpers/learn_gitlab_helper.rb
deleted file mode 100644
index e1241f8b572..00000000000
--- a/app/helpers/learn_gitlab_helper.rb
+++ /dev/null
@@ -1,106 +0,0 @@
-# frozen_string_literal: true
-
-module LearnGitlabHelper
- IMAGE_PATH_PLAN = "learn_gitlab/section_plan.svg"
- IMAGE_PATH_DEPLOY = "learn_gitlab/section_deploy.svg"
- IMAGE_PATH_WORKSPACE = "learn_gitlab/section_workspace.svg"
- LICENSE_SCANNING_RUN_URL = 'https://docs.gitlab.com/ee/user/compliance/license_compliance/index.html'
-
- def learn_gitlab_enabled?(project)
- return false unless current_user
-
- learn_gitlab_onboarding_available?(project)
- end
-
- def learn_gitlab_data(project)
- {
- actions: onboarding_actions_data(project).to_json,
- sections: onboarding_sections_data.to_json,
- project: onboarding_project_data(project).to_json
- }
- end
-
- def learn_gitlab_onboarding_available?(project)
- Onboarding::Progress.onboarding?(project.namespace) &&
- Onboarding::LearnGitlab.new(current_user).available?
- end
-
- private
-
- def onboarding_actions_data(project)
- attributes = onboarding_progress(project).attributes.symbolize_keys
-
- action_urls(project).to_h do |action, url|
- [
- action,
- {
- url: url,
- completed: attributes[Onboarding::Progress.column_name(action)].present?,
- enabled: true
- }
- ]
- end
- end
-
- def onboarding_sections_data
- {
- workspace: {
- svg: image_path(IMAGE_PATH_WORKSPACE)
- },
- plan: {
- svg: image_path(IMAGE_PATH_PLAN)
- },
- deploy: {
- svg: image_path(IMAGE_PATH_DEPLOY)
- }
- }
- end
-
- def onboarding_project_data(project)
- { name: project.name }
- end
-
- def action_urls(project)
- action_issue_urls.merge(
- issue_created: project_issues_path(project),
- git_write: project_path(project),
- merge_request_created: project_merge_requests_path(project),
- user_added: project_members_url(project),
- **deploy_section_action_urls(project)
- )
- end
-
- def action_issue_urls
- Onboarding::Completion::ACTION_ISSUE_IDS.transform_values do |id|
- project_issue_url(learn_gitlab_project, id)
- end
- end
-
- def deploy_section_action_urls(project)
- experiment(
- :security_actions_continuous_onboarding,
- namespace: project.namespace,
- user: current_user,
- sticky_to: current_user
- ) do |e|
- e.control { { security_scan_enabled: project_security_configuration_path(project) } }
- e.candidate do
- {
- license_scanning_run: LICENSE_SCANNING_RUN_URL,
- secure_dependency_scanning_run: project_security_configuration_path(project, anchor: 'dependency-scanning'),
- secure_dast_run: project_security_configuration_path(project, anchor: 'dast')
- }
- end
- end.run
- end
-
- def learn_gitlab_project
- @learn_gitlab_project ||= Onboarding::LearnGitlab.new(current_user).project
- end
-
- def onboarding_progress(project)
- Onboarding::Progress.find_by(namespace: project.namespace) # rubocop: disable CodeReuse/ActiveRecord
- end
-end
-
-LearnGitlabHelper.prepend_mod_with('LearnGitlabHelper')
diff --git a/app/helpers/sidebars_helper.rb b/app/helpers/sidebars_helper.rb
index 9ce68df26a1..5a19ce6149a 100644
--- a/app/helpers/sidebars_helper.rb
+++ b/app/helpers/sidebars_helper.rb
@@ -117,7 +117,6 @@ module SidebarsHelper
{
current_user: user,
container: project,
- learn_gitlab_enabled: learn_gitlab_enabled?(project),
current_ref: current_ref,
ref_type: ref_type,
jira_issues_integration: project_jira_issues_integration?,