Add default_enabled param to sidebar_refactor feature flag

There have been several MRs by different people, using the feature
sidebar_refactor. Nevertheless, some of them use the `default_enabled`
param and others don't.

In this commit we align them by adding the param to all of them.
parent 8ebd37d9
...@@ -43,7 +43,7 @@ module GroupsHelper ...@@ -43,7 +43,7 @@ module GroupsHelper
end end
def group_information_title(group) 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') group.subgroup? ? _('Subgroup information') : _('Group information')
else else
group.subgroup? ? _('Subgroup overview') : _('Group overview') group.subgroup? ? _('Subgroup overview') : _('Group overview')
......
...@@ -12,7 +12,7 @@ module NavHelper ...@@ -12,7 +12,7 @@ module NavHelper
def page_with_sidebar_class def page_with_sidebar_class
class_name = page_gutter_class class_name = page_gutter_class
class_name << 'page-with-contextual-sidebar' if defined?(@left_sidebar) && @left_sidebar 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 << 'page-with-icon-sidebar' if collapsed_sidebar? && @left_sidebar
class_name -= ['right-sidebar-expanded'] if defined?(@right_sidebar) && !@right_sidebar class_name -= ['right-sidebar-expanded'] if defined?(@right_sidebar) && !@right_sidebar
......
...@@ -612,12 +612,12 @@ module ProjectsHelper ...@@ -612,12 +612,12 @@ module ProjectsHelper
end end
def settings_container_registry_expiration_policy_available?(project) 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) can_destroy_container_registry_image?(current_user, project)
end end
def settings_packages_and_registries_enabled?(project) 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) can_destroy_container_registry_image?(current_user, project)
end end
......
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
= nav_link(path: paths, unless: -> { current_path?('groups/contribution_analytics#show') }, html_options: { class: 'home' }) do = nav_link(path: paths, unless: -> { current_path?('groups/contribution_analytics#show') }, html_options: { class: 'home' }) do
= link_to group_path(@group) do = link_to group_path(@group) do
.nav-icon-container .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) = sprite_icon(sprite)
%span.nav-item-name %span.nav-item-name
= group_information_title(@group) = group_information_title(@group)
...@@ -30,7 +30,7 @@ ...@@ -30,7 +30,7 @@
= group_information_title(@group) = group_information_title(@group)
%li.divider.fly-out-top-item %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 = nav_link(path: ['groups#show', 'groups#details', 'groups#subgroups'], html_options: { class: 'home' }) do
= link_to details_group_path(@group), title: _('Group details') do = link_to details_group_path(@group), title: _('Group details') do
%span %span
......
...@@ -37,7 +37,7 @@ module Sidebars ...@@ -37,7 +37,7 @@ module Sidebars
private private
def list_menu_item 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) return ::Sidebars::NilMenuItem.new(item_id: :requirements_list)
end end
......
...@@ -6,7 +6,7 @@ module Sidebars ...@@ -6,7 +6,7 @@ module Sidebars
class InfrastructureMenu < ::Sidebars::Menu class InfrastructureMenu < ::Sidebars::Menu
override :configure_menu_items override :configure_menu_items
def 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) return false unless context.project.feature_available?(:operations, context.current_user)
add_item(kubernetes_menu_item) add_item(kubernetes_menu_item)
......
...@@ -98,7 +98,7 @@ module Sidebars ...@@ -98,7 +98,7 @@ module Sidebars
end end
def labels_menu_item 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) return ::Sidebars::NilMenuItem.new(item_id: :labels)
end end
......
...@@ -40,7 +40,7 @@ module Sidebars ...@@ -40,7 +40,7 @@ module Sidebars
override :render? override :render?
def 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? can?(context.current_user, :read_label, context.project) && !context.project.issues_enabled?
end end
......
...@@ -139,7 +139,7 @@ module Sidebars ...@@ -139,7 +139,7 @@ module Sidebars
end end
def serverless_menu_item 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) !can?(context.current_user, :read_cluster, context.project)
return ::Sidebars::NilMenuItem.new(item_id: :serverless) return ::Sidebars::NilMenuItem.new(item_id: :serverless)
end end
...@@ -153,7 +153,7 @@ module Sidebars ...@@ -153,7 +153,7 @@ module Sidebars
end end
def terraform_menu_item 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) !can?(context.current_user, :read_terraform_state, context.project)
return ::Sidebars::NilMenuItem.new(item_id: :terraform) return ::Sidebars::NilMenuItem.new(item_id: :terraform)
end end
...@@ -167,7 +167,7 @@ module Sidebars ...@@ -167,7 +167,7 @@ module Sidebars
end end
def kubernetes_menu_item 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) !can?(context.current_user, :read_cluster, context.project)
return ::Sidebars::NilMenuItem.new(item_id: :kubernetes) return ::Sidebars::NilMenuItem.new(item_id: :kubernetes)
end end
......
...@@ -34,7 +34,7 @@ module Sidebars ...@@ -34,7 +34,7 @@ module Sidebars
override :title override :title
def title def title
if Feature.enabled?(:sidebar_refactor, context.current_user) if Feature.enabled?(:sidebar_refactor, context.current_user, default_enabled: :yaml)
_('Project information') _('Project information')
else else
_('Project overview') _('Project overview')
...@@ -43,7 +43,7 @@ module Sidebars ...@@ -43,7 +43,7 @@ module Sidebars
override :sprite_icon override :sprite_icon
def 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' 'project'
else else
'home' 'home'
...@@ -52,7 +52,7 @@ module Sidebars ...@@ -52,7 +52,7 @@ module Sidebars
override :active_routes override :active_routes
def 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' } { path: 'projects#show' }
end end
...@@ -60,7 +60,7 @@ module Sidebars ...@@ -60,7 +60,7 @@ module Sidebars
private private
def details_menu_item 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( ::Sidebars::MenuItem.new(
title: _('Details'), title: _('Details'),
...@@ -103,7 +103,7 @@ module Sidebars ...@@ -103,7 +103,7 @@ module Sidebars
end end
def labels_menu_item 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) return ::Sidebars::NilMenuItem.new(item_id: :labels)
end end
......
...@@ -136,7 +136,7 @@ module Sidebars ...@@ -136,7 +136,7 @@ module Sidebars
def packages_and_registries_menu_item def packages_and_registries_menu_item
if !Gitlab.config.registry.enabled || 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) !can?(context.current_user, :destroy_container_image, context.project)
return ::Sidebars::NilMenuItem.new(item_id: :packages_and_registries) return ::Sidebars::NilMenuItem.new(item_id: :packages_and_registries)
end 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