Commit f66f448b authored by Rémy Coutable's avatar Rémy Coutable

Merge branch 'fj-enable-by-default-sidebar-refactor-ff' into 'master'

Add default_enabled param to sidebar_refactor feature flag

See merge request gitlab-org/gitlab!61666
parents 29e4bf30 fe4e73d6
......@@ -43,7 +43,7 @@ module GroupsHelper
end
def group_information_title(group)
if Feature.enabled?(:sidebar_refactor, current_user)
if Feature.enabled?(:sidebar_refactor, current_user, default_enabled: :yaml)
group.subgroup? ? _('Subgroup information') : _('Group information')
else
group.subgroup? ? _('Subgroup overview') : _('Group overview')
......
......@@ -12,7 +12,7 @@ module NavHelper
def page_with_sidebar_class
class_name = page_gutter_class
class_name << 'page-with-contextual-sidebar' if defined?(@left_sidebar) && @left_sidebar
class_name << 'sidebar-refactoring' if Feature.enabled?(:sidebar_refactor, current_user)
class_name << 'sidebar-refactoring' if Feature.enabled?(:sidebar_refactor, current_user, default_enabled: :yaml)
class_name << 'page-with-icon-sidebar' if collapsed_sidebar? && @left_sidebar
class_name -= ['right-sidebar-expanded'] if defined?(@right_sidebar) && !@right_sidebar
......
......@@ -612,12 +612,12 @@ module ProjectsHelper
end
def settings_container_registry_expiration_policy_available?(project)
Feature.disabled?(:sidebar_refactor, current_user) &&
Feature.disabled?(:sidebar_refactor, current_user, default_enabled: :yaml) &&
can_destroy_container_registry_image?(current_user, project)
end
def settings_packages_and_registries_enabled?(project)
Feature.enabled?(:sidebar_refactor, current_user) &&
Feature.enabled?(:sidebar_refactor, current_user, default_enabled: :yaml) &&
can_destroy_container_registry_image?(current_user, project)
end
......
......@@ -18,7 +18,7 @@
= nav_link(path: paths, unless: -> { current_path?('groups/contribution_analytics#show') }, html_options: { class: 'home' }) do
= link_to group_path(@group) do
.nav-icon-container
- sprite = Feature.enabled?(:sidebar_refactor, current_user) ? 'group' : 'home'
- sprite = Feature.enabled?(:sidebar_refactor, current_user, default_enabled: :yaml) ? 'group' : 'home'
= sprite_icon(sprite)
%span.nav-item-name
= group_information_title(@group)
......@@ -30,7 +30,7 @@
= group_information_title(@group)
%li.divider.fly-out-top-item
- if Feature.disabled?(:sidebar_refactor, current_user)
- if Feature.disabled?(:sidebar_refactor, current_user, default_enabled: :yaml)
= nav_link(path: ['groups#show', 'groups#details', 'groups#subgroups'], html_options: { class: 'home' }) do
= link_to details_group_path(@group), title: _('Group details') do
%span
......
......@@ -37,7 +37,7 @@ module Sidebars
private
def list_menu_item
if Feature.enabled?(:sidebar_refactor, context.current_user)
if Feature.enabled?(:sidebar_refactor, context.current_user, default_enabled: :yaml)
return ::Sidebars::NilMenuItem.new(item_id: :requirements_list)
end
......
......@@ -6,7 +6,7 @@ module Sidebars
class InfrastructureMenu < ::Sidebars::Menu
override :configure_menu_items
def configure_menu_items
return false if Feature.disabled?(:sidebar_refactor, context.current_user)
return false if Feature.disabled?(:sidebar_refactor, context.current_user, default_enabled: :yaml)
return false unless context.project.feature_available?(:operations, context.current_user)
add_item(kubernetes_menu_item)
......
......@@ -98,7 +98,7 @@ module Sidebars
end
def labels_menu_item
if Feature.enabled?(:sidebar_refactor, context.current_user)
if Feature.enabled?(:sidebar_refactor, context.current_user, default_enabled: :yaml)
return ::Sidebars::NilMenuItem.new(item_id: :labels)
end
......
......@@ -40,7 +40,7 @@ module Sidebars
override :render?
def render?
return false if Feature.enabled?(:sidebar_refactor, context.current_user)
return false if Feature.enabled?(:sidebar_refactor, context.current_user, default_enabled: :yaml)
can?(context.current_user, :read_label, context.project) && !context.project.issues_enabled?
end
......
......@@ -139,7 +139,7 @@ module Sidebars
end
def serverless_menu_item
if Feature.enabled?(:sidebar_refactor, context.current_user) ||
if Feature.enabled?(:sidebar_refactor, context.current_user, default_enabled: :yaml) ||
!can?(context.current_user, :read_cluster, context.project)
return ::Sidebars::NilMenuItem.new(item_id: :serverless)
end
......@@ -153,7 +153,7 @@ module Sidebars
end
def terraform_menu_item
if Feature.enabled?(:sidebar_refactor, context.current_user) ||
if Feature.enabled?(:sidebar_refactor, context.current_user, default_enabled: :yaml) ||
!can?(context.current_user, :read_terraform_state, context.project)
return ::Sidebars::NilMenuItem.new(item_id: :terraform)
end
......@@ -167,7 +167,7 @@ module Sidebars
end
def kubernetes_menu_item
if Feature.enabled?(:sidebar_refactor, context.current_user) ||
if Feature.enabled?(:sidebar_refactor, context.current_user, default_enabled: :yaml) ||
!can?(context.current_user, :read_cluster, context.project)
return ::Sidebars::NilMenuItem.new(item_id: :kubernetes)
end
......
......@@ -34,7 +34,7 @@ module Sidebars
override :title
def title
if Feature.enabled?(:sidebar_refactor, context.current_user)
if Feature.enabled?(:sidebar_refactor, context.current_user, default_enabled: :yaml)
_('Project information')
else
_('Project overview')
......@@ -43,7 +43,7 @@ module Sidebars
override :sprite_icon
def sprite_icon
if Feature.enabled?(:sidebar_refactor, context.current_user)
if Feature.enabled?(:sidebar_refactor, context.current_user, default_enabled: :yaml)
'project'
else
'home'
......@@ -52,7 +52,7 @@ module Sidebars
override :active_routes
def active_routes
return {} if Feature.disabled?(:sidebar_refactor, context.current_user)
return {} if Feature.disabled?(:sidebar_refactor, context.current_user, default_enabled: :yaml)
{ path: 'projects#show' }
end
......@@ -60,7 +60,7 @@ module Sidebars
private
def details_menu_item
return if Feature.enabled?(:sidebar_refactor, context.current_user)
return if Feature.enabled?(:sidebar_refactor, context.current_user, default_enabled: :yaml)
::Sidebars::MenuItem.new(
title: _('Details'),
......@@ -103,7 +103,7 @@ module Sidebars
end
def labels_menu_item
if Feature.disabled?(:sidebar_refactor, context.current_user)
if Feature.disabled?(:sidebar_refactor, context.current_user, default_enabled: :yaml)
return ::Sidebars::NilMenuItem.new(item_id: :labels)
end
......
......@@ -136,7 +136,7 @@ module Sidebars
def packages_and_registries_menu_item
if !Gitlab.config.registry.enabled ||
Feature.disabled?(:sidebar_refactor, context.current_user) ||
Feature.disabled?(:sidebar_refactor, context.current_user, default_enabled: :yaml) ||
!can?(context.current_user, :destroy_container_image, context.project)
return ::Sidebars::NilMenuItem.new(item_id: :packages_and_registries)
end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment