diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-08-20 18:42:06 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-08-20 18:42:06 +0000 |
commit | 6e4e1050d9dba2b7b2523fdd1768823ab85feef4 (patch) | |
tree | 78be5963ec075d80116a932011d695dd33910b4e /app/helpers/projects_helper.rb | |
parent | 1ce776de4ae122aba3f349c02c17cebeaa8ecf07 (diff) | |
download | gitlab-ce-6e4e1050d9dba2b7b2523fdd1768823ab85feef4.tar.gz |
Add latest changes from gitlab-org/gitlab@13-3-stable-ee
Diffstat (limited to 'app/helpers/projects_helper.rb')
-rw-r--r-- | app/helpers/projects_helper.rb | 44 |
1 files changed, 35 insertions, 9 deletions
diff --git a/app/helpers/projects_helper.rb b/app/helpers/projects_helper.rb index 840e3ef9daa..1ce4903f8df 100644 --- a/app/helpers/projects_helper.rb +++ b/app/helpers/projects_helper.rb @@ -104,7 +104,7 @@ module ProjectsHelper end def remove_project_message(project) - _("You are going to remove %{project_full_name}. Removed project CANNOT be restored! Are you ABSOLUTELY sure?") % + _("You are going to delete %{project_full_name}. Deleted projects CANNOT be restored! Are you ABSOLUTELY sure?") % { project_full_name: project.full_name } end @@ -184,9 +184,8 @@ module ProjectsHelper end def autodeploy_flash_notice(branch_name) - translation = _("Branch <strong>%{branch_name}</strong> was created. To set up auto deploy, choose a GitLab CI Yaml template and commit your changes. %{link_to_autodeploy_doc}") % - { branch_name: truncate(sanitize(branch_name)), link_to_autodeploy_doc: link_to_autodeploy_doc } - translation.html_safe + html_escape(_("Branch %{branch_name} was created. To set up auto deploy, choose a GitLab CI Yaml template and commit your changes. %{link_to_autodeploy_doc}")) % + { branch_name: tag.strong(truncate(sanitize(branch_name))), link_to_autodeploy_doc: link_to_autodeploy_doc } end def project_list_cache_key(project, pipeline_status: true) @@ -353,14 +352,14 @@ module ProjectsHelper description = if share_with_group && share_with_members - _("You can invite a new member to <strong>%{project_name}</strong> or invite another group.") + _("You can invite a new member to %{project_name} or invite another group.") elsif share_with_group - _("You can invite another group to <strong>%{project_name}</strong>.") + _("You can invite another group to %{project_name}.") elsif share_with_members - _("You can invite a new member to <strong>%{project_name}</strong>.") + _("You can invite a new member to %{project_name}.") end - description.html_safe % { project_name: project.name } + html_escape(description) % { project_name: tag.strong(project.name) } end def metrics_external_dashboard_url @@ -421,6 +420,10 @@ module ProjectsHelper nav_tabs << :operations end + if can_view_product_analytics?(current_user, project) + nav_tabs << :product_analytics + end + tab_ability_map.each do |tab, ability| if can?(current_user, ability, project) nav_tabs << tab @@ -429,9 +432,19 @@ module ProjectsHelper apply_external_nav_tabs(nav_tabs, project) + nav_tabs += package_nav_tabs(project, current_user) + nav_tabs end + def package_nav_tabs(project, current_user) + [].tap do |tabs| + if ::Gitlab.config.packages.enabled && can?(current_user, :read_package, project) + tabs << :packages + end + end + end + def apply_external_nav_tabs(nav_tabs, project) nav_tabs << :external_issue_tracker if project.external_issue_tracker nav_tabs << :external_wiki if project.external_wiki @@ -455,6 +468,7 @@ module ProjectsHelper serverless: :read_cluster, error_tracking: :read_sentry_issue, alert_management: :read_alert_management_alert, + incidents: :read_incidents, labels: :read_label, issues: :read_issue, project_members: :read_project_member, @@ -468,6 +482,11 @@ module ProjectsHelper end end + def can_view_product_analytics?(current_user, project) + Feature.enabled?(:product_analytics, project) && + can?(current_user, :read_product_analytics, project) + end + def search_tab_ability_map @search_tab_ability_map ||= tab_ability_map.merge( blobs: :download_code, @@ -584,6 +603,7 @@ module ProjectsHelper def project_permissions_settings(project) feature = project.project_feature { + packagesEnabled: !!project.packages_enabled, visibilityLevel: project.visibility_level, requestAccessEnabled: !!project.request_access_enabled, issuesAccessLevel: feature.issues_access_level, @@ -604,6 +624,8 @@ module ProjectsHelper def project_permissions_panel_data(project) { + packagesAvailable: ::Gitlab.config.packages.enabled, + packagesHelpPath: help_page_path('user/packages/index'), currentSettings: project_permissions_settings(project), canDisableEmails: can_disable_emails?(project, current_user), canChangeVisibilityLevel: can_change_visibility_level?(project, current_user), @@ -719,9 +741,13 @@ module ProjectsHelper functions error_tracking alert_management + incidents + incident_management user gcp logs + product_analytics + metrics_dashboard ] end @@ -748,7 +774,7 @@ module ProjectsHelper def project_access_token_available?(project) return false if ::Gitlab.com? - ::Feature.enabled?(:resource_access_token, project) + ::Feature.enabled?(:resource_access_token, project, default_enabled: true) end end |