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-12-22 21:10:41 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2023-12-22 21:10:41 +0300
commite5f8220301d524167441f8fac5fd5fcf5fc31e1f (patch)
tree1b73a8c16126db5386b5bae59f61e990a457acc5 /app/helpers
parentc60010859638f577dab891358e83945561b35ad2 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/helpers')
-rw-r--r--app/helpers/sidebars_helper.rb36
1 files changed, 10 insertions, 26 deletions
diff --git a/app/helpers/sidebars_helper.rb b/app/helpers/sidebars_helper.rb
index 9933fa8e4d9..92a4f32dfda 100644
--- a/app/helpers/sidebars_helper.rb
+++ b/app/helpers/sidebars_helper.rb
@@ -68,6 +68,16 @@ module SidebarsHelper
name: user.name,
username: user.username,
admin_url: admin_root_url,
+ admin_mode: {
+ admin_mode_feature_enabled: Gitlab::CurrentSettings.admin_mode,
+ admin_mode_active: current_user_mode.admin_mode?,
+ enter_admin_mode_url: new_admin_session_path,
+ leave_admin_mode_url: destroy_admin_session_path,
+ # Usually, using current_user.admin? is discouraged because it does not
+ # check for admin mode, but since here we want to check admin? and admin mode
+ # separately, we'll have to ignore the cop rule.
+ user_is_admin: user.admin? # rubocop: disable Cop/UserAdmin
+ },
avatar_url: user.avatar_url,
has_link_to_profile: current_user_menu?(:profile),
link_to_profile: user_path(user),
@@ -353,38 +363,12 @@ module SidebarsHelper
({ title: s_('Navigation|Preferences'), link: profile_preferences_path, icon: 'preferences' } if current_user)
]
- # Usually, using current_user.admin? is discouraged because it does not
- # check for admin mode, but since here we want to check admin? and admin mode
- # separately, we'll have to ignore the cop rule.
- # rubocop: disable Cop/UserAdmin
if current_user&.can_admin_all_resources?
links.append(
{ title: s_('Navigation|Admin Area'), link: admin_root_path, icon: 'admin' }
)
end
- if Gitlab::CurrentSettings.admin_mode
- if header_link?(:admin_mode)
- links.append(
- {
- title: s_('Navigation|Leave admin mode'),
- link: destroy_admin_session_path,
- icon: 'lock-open',
- data_method: 'post'
- }
- )
- elsif current_user&.admin?
- links.append(
- {
- title: s_('Navigation|Enter admin mode'),
- link: new_admin_session_path,
- icon: 'lock'
- }
- )
- end
- end
- # rubocop: enable Cop/UserAdmin
-
links.compact
end