Skip to content
Snippets Groups Projects
Commit 366b3ce9 authored by Sascha Eggenberger's avatar Sascha Eggenberger :speech_balloon:
Browse files

User profile: Hide sidebar if user is blocked

Changelog: changed
parent bfb1f679
1 merge request!147354User profile: Hide sidebar if user is blocked
......@@ -168,6 +168,14 @@
.user-profile {
position: relative;
@include media-breakpoint-up(lg) {
display: grid;
grid-template-columns: 1fr;
gap: 2rem;
}
}
.user-profile-with-sidebar {
@include media-breakpoint-up(lg) {
display: grid;
grid-template-columns: 1fr $right-sidebar-width;
......
......@@ -2,7 +2,7 @@
.profile-header.gl-pb-5.gl-pt-3.gl-overflow-y-auto.gl-sm-pr-4
.gl-vertical-align-top.gl-text-left.gl-max-w-80.gl-overflow-wrap-anywhere
.user-info
- if !@user.blocked? && @user.confirmed?
- if @user.confirmed?
.gl-display-flex.gl-gap-4.gl-flex-direction-column
- if @user.pronouns.present? || @user.pronunciation.present? || @user.bio.present?
%div
......@@ -80,52 +80,3 @@
.gl-display-flex.gl-gap-2.gl-mb-2
= sprite_icon('discord', css_class: 'fgray gl-mt-1 flex-shrink-0')
= link_to @user.discord, discord_url(@user), class: 'gl-text-gray-900', title: "Discord", target: '_blank', rel: 'noopener noreferrer nofollow'
-# TODO: Remove this with the removal of the old navigation.
-# See https://gitlab.com/gitlab-org/gitlab/-/issues/435899.
- if !profile_tabs.empty? && !Feature.enabled?(:profile_tabs_vue, current_user)
.scrolling-tabs-container.gl-display-none
%button.fade-left{ type: 'button', title: _('Scroll left'), 'aria-label': _('Scroll left') }
= sprite_icon('chevron-lg-left', size: 12)
%button.fade-right{ type: 'button', title: _('Scroll right'), 'aria-label': _('Scroll right') }
= sprite_icon('chevron-lg-right', size: 12)
%ul.nav-links.user-profile-nav.scrolling-tabs.nav.nav-tabs.gl-border-b-0
- if profile_tab?(:overview)
%li.js-overview-tab
= link_to user_path, data: { target: 'div#js-overview', action: 'overview', toggle: 'tab' } do
= s_('UserProfile|Overview')
- if profile_tab?(:activity)
%li.js-activity-tab
= link_to user_activity_path, data: { target: 'div#activity', action: 'activity', toggle: 'tab' } do
= s_('UserProfile|Activity')
- unless Feature.enabled?(:security_auto_fix) && @user.bot?
- if profile_tab?(:groups)
%li.js-groups-tab
= link_to user_groups_path, data: { target: 'div#groups', action: 'groups', toggle: 'tab', endpoint: user_groups_path(format: :json) } do
= s_('UserProfile|Groups')
- if profile_tab?(:contributed)
%li.js-contributed-tab
= link_to user_contributed_projects_path, data: { target: 'div#contributed', action: 'contributed', toggle: 'tab', endpoint: user_contributed_projects_path(format: :json) } do
= s_('UserProfile|Contributed projects')
- if profile_tab?(:projects)
%li.js-projects-tab
= link_to user_projects_path, data: { target: 'div#projects', action: 'projects', toggle: 'tab', endpoint: user_projects_path(format: :json) } do
= s_('UserProfile|Personal projects')
- if profile_tab?(:starred)
%li.js-starred-tab
= link_to user_starred_projects_path, data: { target: 'div#starred', action: 'starred', toggle: 'tab', endpoint: user_starred_projects_path(format: :json), card_mode: true } do
= s_('UserProfile|Starred projects')
- if profile_tab?(:snippets)
%li.js-snippets-tab
= link_to user_snippets_path, data: { target: 'div#snippets', action: 'snippets', toggle: 'tab', endpoint: user_snippets_path(format: :json) } do
= s_('UserProfile|Snippets')
- if profile_tab?(:followers)
%li.js-followers-tab
= link_to user_followers_path, data: { target: 'div#followers', action: 'followers', toggle: 'tab', endpoint: user_followers_path(format: :json) } do
= s_('UserProfile|Followers')
= gl_badge_tag @user.followers.count, size: :sm
- if profile_tab?(:following)
%li.js-following-tab
= link_to user_following_path, data: { target: 'div#following', action: 'following', toggle: 'tab', endpoint: user_following_path(format: :json), testid: 'following_tab' } do
= s_('UserProfile|Following')
= gl_badge_tag @user.followees.count, size: :sm
......@@ -41,7 +41,7 @@
.gl-display-inline-flex.gl-gap-3.gl-align-items-baseline
= emoji_icon(@user.status.emoji)
= markdown_field(@user.status, :message)
.user-profile
.user-profile{ class: @user.blocked? ? '' : 'user-profile-with-sidebar' }
.user-profile-content
- if !profile_tabs.empty? && Feature.enabled?(:profile_tabs_vue, current_user)
#js-profile-tabs{ data: user_profile_tabs_app_data(@user) }
......@@ -98,4 +98,54 @@
= render Pajamas::EmptyStateComponent.new(svg_path: 'illustrations/empty-state/empty-private-md.svg',
title: s_('UserProfile|This user has a private profile'))
= render 'users/profile_sidebar'
- unless @user.blocked?
= render 'users/profile_sidebar'
-# TODO: Remove this with the removal of the old navigatifon.
-# See https://gitlab.com/gitlab-org/gitlab/-/issues/435899.
- if !profile_tabs.empty? && !Feature.enabled?(:profile_tabs_vue, current_user)
.scrolling-tabs-container.gl-display-none
%button.fade-left{ type: 'button', title: _('Scroll left'), 'aria-label': _('Scroll left') }
= sprite_icon('chevron-lg-left', size: 12)
%button.fade-right{ type: 'button', title: _('Scroll right'), 'aria-label': _('Scroll right') }
= sprite_icon('chevron-lg-right', size: 12)
%ul.nav-links.user-profile-nav.scrolling-tabs.nav.nav-tabs.gl-border-b-0
- if profile_tab?(:overview)
%li.js-overview-tab
= link_to user_path, data: { target: 'div#js-overview', action: 'overview', toggle: 'tab' } do
= s_('UserProfile|Overview')
- if profile_tab?(:activity)
%li.js-activity-tab
= link_to user_activity_path, data: { target: 'div#activity', action: 'activity', toggle: 'tab' } do
= s_('UserProfile|Activity')
- unless Feature.enabled?(:security_auto_fix) && @user.bot?
- if profile_tab?(:groups)
%li.js-groups-tab
= link_to user_groups_path, data: { target: 'div#groups', action: 'groups', toggle: 'tab', endpoint: user_groups_path(format: :json) } do
= s_('UserProfile|Groups')
- if profile_tab?(:contributed)
%li.js-contributed-tab
= link_to user_contributed_projects_path, data: { target: 'div#contributed', action: 'contributed', toggle: 'tab', endpoint: user_contributed_projects_path(format: :json) } do
= s_('UserProfile|Contributed projects')
- if profile_tab?(:projects)
%li.js-projects-tab
= link_to user_projects_path, data: { target: 'div#projects', action: 'projects', toggle: 'tab', endpoint: user_projects_path(format: :json) } do
= s_('UserProfile|Personal projects')
- if profile_tab?(:starred)
%li.js-starred-tab
= link_to user_starred_projects_path, data: { target: 'div#starred', action: 'starred', toggle: 'tab', endpoint: user_starred_projects_path(format: :json), card_mode: true } do
= s_('UserProfile|Starred projects')
- if profile_tab?(:snippets)
%li.js-snippets-tab
= link_to user_snippets_path, data: { target: 'div#snippets', action: 'snippets', toggle: 'tab', endpoint: user_snippets_path(format: :json) } do
= s_('UserProfile|Snippets')
- if profile_tab?(:followers)
%li.js-followers-tab
= link_to user_followers_path, data: { target: 'div#followers', action: 'followers', toggle: 'tab', endpoint: user_followers_path(format: :json) } do
= s_('UserProfile|Followers')
= gl_badge_tag @user.followers.count, size: :sm
- if profile_tab?(:following)
%li.js-following-tab
= link_to user_following_path, data: { target: 'div#following', action: 'following', toggle: 'tab', endpoint: user_following_path(format: :json), testid: 'following_tab' } do
= s_('UserProfile|Following')
= gl_badge_tag @user.followees.count, size: :sm
......@@ -296,10 +296,14 @@
end
it 'shows no tab' do
expect(page).to have_css("div.profile-header")
expect(page).not_to have_css("div.profile-header")
expect(page).not_to have_css("ul.nav-links")
end
it 'shows no sidebar' do
expect(page).not_to have_css(".user-profile-sidebar")
end
it 'shows blocked message' do
expect(page).to have_content("This user is blocked")
end
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment