summaryrefslogtreecommitdiff
path: root/app/helpers/projects_helper.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/helpers/projects_helper.rb')
-rw-r--r--app/helpers/projects_helper.rb35
1 files changed, 17 insertions, 18 deletions
diff --git a/app/helpers/projects_helper.rb b/app/helpers/projects_helper.rb
index bda9a69d71f..840e3ef9daa 100644
--- a/app/helpers/projects_helper.rb
+++ b/app/helpers/projects_helper.rb
@@ -180,7 +180,7 @@ module ProjectsHelper
end
def link_to_autodeploy_doc
- link_to _('About auto deploy'), help_page_path('autodevops/index.md#auto-deploy'), target: '_blank'
+ link_to _('About auto deploy'), help_page_path('topics/autodevops/stages.md', anchor: 'auto-deploy'), target: '_blank'
end
def autodeploy_flash_notice(branch_name)
@@ -384,9 +384,12 @@ module ProjectsHelper
end
def project_license_name(project)
- project.repository.license&.name
+ key = "project:#{project.id}:license_name"
+
+ Gitlab::SafeRequestStore.fetch(key) { project.repository.license&.name }
rescue GRPC::Unavailable, GRPC::DeadlineExceeded, Gitlab::Git::CommandError => e
Gitlab::ErrorTracking.track_exception(e)
+ Gitlab::SafeRequestStore[key] = nil
nil
end
@@ -397,7 +400,7 @@ module ProjectsHelper
nav_tabs = [:home]
unless project.empty_repo?
- nav_tabs << [:files, :commits, :network, :graphs, :forks] if can?(current_user, :download_code, project)
+ nav_tabs += [:files, :commits, :network, :graphs, :forks] if can?(current_user, :download_code, project)
nav_tabs << :releases if can?(current_user, :read_release, project)
end
@@ -418,30 +421,30 @@ module ProjectsHelper
nav_tabs << :operations
end
- if can?(current_user, :read_cycle_analytics, project)
- nav_tabs << :cycle_analytics
- end
-
tab_ability_map.each do |tab, ability|
if can?(current_user, ability, project)
nav_tabs << tab
end
end
- nav_tabs << external_nav_tabs(project)
+ apply_external_nav_tabs(nav_tabs, project)
- nav_tabs.flatten
+ nav_tabs
end
- def external_nav_tabs(project)
- [].tap do |tabs|
- tabs << :external_issue_tracker if project.external_issue_tracker
- tabs << :external_wiki if project.external_wiki
+ 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
+
+ if project.has_confluence?
+ nav_tabs.delete(:wiki)
+ nav_tabs << :confluence
end
end
def tab_ability_map
{
+ cycle_analytics: :read_cycle_analytics,
environments: :read_environment,
metrics_dashboards: :metrics_dashboard,
milestones: :read_milestone,
@@ -565,7 +568,7 @@ module ProjectsHelper
end
def project_child_container_class(view_path)
- view_path == "projects/issues/issues" ? "prepend-top-default" : "project-show-#{view_path}"
+ view_path == "projects/issues/issues" ? "gl-mt-3" : "project-show-#{view_path}"
end
def project_issues(project)
@@ -729,10 +732,6 @@ module ProjectsHelper
!project.repository.gitlab_ci_yml
end
- def vue_file_list_enabled?
- Feature.enabled?(:vue_file_list, @project, default_enabled: true)
- end
-
def native_code_navigation_enabled?(project)
Feature.enabled?(:code_navigation, project, default_enabled: true)
end