Commit 3719e613 authored by Mayra Cabrera's avatar Mayra Cabrera

Merge branch 'vs-remove-users-over-license-banner' into 'master'

Remove "Users over license" banner

See merge request gitlab-org/gitlab!39836
parents abb67e1e 094e09f1
...@@ -5,7 +5,6 @@ ...@@ -5,7 +5,6 @@
.mobile-overlay .mobile-overlay
.alert-wrapper .alert-wrapper
= render 'shared/outdated_browser' = render 'shared/outdated_browser'
= render_if_exists 'layouts/header/users_over_license_banner'
= render_if_exists "layouts/header/licensed_user_count_threshold" = render_if_exists "layouts/header/licensed_user_count_threshold"
= render_if_exists "layouts/header/token_expiry_notification" = render_if_exists "layouts/header/token_expiry_notification"
= render "layouts/broadcast" = render "layouts/broadcast"
......
...@@ -11,7 +11,6 @@ module EE ...@@ -11,7 +11,6 @@ module EE
GOLD_TRIAL_BILLINGS = 'gold_trial_billings' GOLD_TRIAL_BILLINGS = 'gold_trial_billings'
THREAT_MONITORING_INFO = 'threat_monitoring_info' THREAT_MONITORING_INFO = 'threat_monitoring_info'
ACCOUNT_RECOVERY_REGULAR_CHECK = 'account_recovery_regular_check' ACCOUNT_RECOVERY_REGULAR_CHECK = 'account_recovery_regular_check'
USERS_OVER_LICENSE_BANNER = 'users_over_license_banner'
ACTIVE_USER_COUNT_THRESHOLD = 'active_user_count_threshold' ACTIVE_USER_COUNT_THRESHOLD = 'active_user_count_threshold'
PERSONAL_ACCESS_TOKEN_EXPIRY = 'personal_access_token_expiry' PERSONAL_ACCESS_TOKEN_EXPIRY = 'personal_access_token_expiry'
......
...@@ -11,10 +11,6 @@ module LicenseMonitoringHelper ...@@ -11,10 +11,6 @@ module LicenseMonitoringHelper
{ range: (1000..nil), percentage: true, value: 5 } { range: (1000..nil), percentage: true, value: 5 }
].freeze ].freeze
def show_users_over_license_banner?
current_user&.admin? && license_is_over_capacity?
end
def show_active_user_count_threshold_banner? def show_active_user_count_threshold_banner?
return if ::Gitlab.com? return if ::Gitlab.com?
return if current_license.nil? || current_license.trial? return if current_license.nil? || current_license.trial?
......
...@@ -19,7 +19,6 @@ module EE ...@@ -19,7 +19,6 @@ module EE
gold_trial_billings: 8, gold_trial_billings: 8,
threat_monitoring_info: 11, threat_monitoring_info: 11,
account_recovery_regular_check: 12, account_recovery_regular_check: 12,
users_over_license_banner: 16,
active_user_count_threshold: 18, active_user_count_threshold: 18,
buy_pipeline_minutes_notification_dot: 19 buy_pipeline_minutes_notification_dot: 19
) )
......
- not_dismissed_or_in_admin_area = admin_section? || !user_dismissed?(UserCalloutsHelper::USERS_OVER_LICENSE_BANNER)
- return unless not_dismissed_or_in_admin_area && show_users_over_license_banner?
.gl-alert.gl-alert-info.js-users-over-license-callout{ role: 'alert', data: { feature_id: "users_over_license_banner", dismiss_endpoint: user_callouts_path, defer_links: "true" } }
= sprite_icon('information-o', css_class: 'gl-icon gl-alert-icon')
- unless admin_section?
%button.js-close.gl-alert-dismiss.gl-cursor-pointer{ type: 'button', 'aria-label' => _('Dismiss') }
= sprite_icon('close', css_class: 'gl-icon')
.gl-alert-body
%h3.gl-alert-title= s_('License|Licensed user count exceeded')
%p
= s_("License|Your instance has exceeded your subscription's number of licensed users by %{extra_users_count}. You can continue to add more users and we'll include the overage in your next bill.").html_safe % {extra_users_count: current_license_overage}
.gl-alert-actions
= link_to _('Learn more'), 'https://docs.gitlab.com/ee/subscriptions', class: 'btn btn-info gl-alert-action', target: '_blank'
= link_to _('Contact support'), 'https://about.gitlab.com/support/#contact-support', class: 'btn btn-info btn-secondary gl-button', target: '_blank'
---
title: Remove Users over license banner
merge_request: 39836
author:
type: removed
# frozen_string_literal: true
require 'spec_helper'
RSpec.describe 'Show users over license banner', :js do
include StubRequests
let_it_be(:admin) { create(:admin) }
let_it_be(:user) { create(:user) }
let_it_be(:license_seats_limit) { 10 }
let_it_be(:license) do
create(:license, data: build(:gitlab_license, restrictions: { active_user_count: license_seats_limit }).export)
end
shared_examples_for "a visible banner" do
let(:visit_path) { root_dashboard_path }
it 'shows the banner' do
visit visit_path
expect(page).to have_content('Licensed user count exceeded')
end
end
shared_examples_for "a hidden banner" do
it 'does not show the banner' do
visit root_dashboard_path
expect(page).not_to have_content('Licensed user count exceeded')
end
end
before do
create(:historical_data, date: license.created_at + 1.month, active_user_count: active_user_count)
end
context "with users over license" do
let(:active_user_count) { license_seats_limit + 5 }
context 'when admin is logged in' do
before do
gitlab_sign_in(admin)
end
it_behaves_like 'a visible banner'
context 'when banner was dismissed' do
before do
visit root_dashboard_path
find('.gl-alert-dismiss').click
end
it_behaves_like 'a hidden banner'
context 'when visiting the admin section' do
it_behaves_like 'a visible banner' do
let(:visit_path) { admin_users_path }
end
end
end
end
context 'when regular user is logged in' do
before do
gitlab_sign_in(user)
end
it_behaves_like 'a hidden banner'
end
end
context "without users over license" do
let(:active_user_count) { 1 }
context 'when admin is logged in' do
before do
gitlab_sign_in(admin)
end
it_behaves_like 'a hidden banner'
end
context 'when regular user is logged in' do
before do
gitlab_sign_in(user)
end
it_behaves_like 'a hidden banner'
end
end
end
...@@ -15,64 +15,6 @@ RSpec.describe LicenseMonitoringHelper do ...@@ -15,64 +15,6 @@ RSpec.describe LicenseMonitoringHelper do
create(:historical_data, date: license.created_at + 1.month, active_user_count: active_user_count) create(:historical_data, date: license.created_at + 1.month, active_user_count: active_user_count)
end end
describe '#show_users_over_license_banner?' do
subject { helper.show_users_over_license_banner? }
context 'when admin is logged in' do
before do
allow(helper).to receive(:current_user).and_return(admin)
end
context 'when license is above the threshold' do
let(:active_user_count) { license_seats_limit + 5 }
it { is_expected.to eq(true) }
end
context 'when license is below the threshold' do
let(:active_user_count) { 1 }
it { is_expected.to eq(false) }
end
end
context 'when regular user is logged in' do
before do
allow(helper).to receive(:current_user).and_return(user)
end
context 'when license is above the threshold' do
let(:active_user_count) { license_seats_limit + 5 }
it { is_expected.to eq(false) }
end
context 'when license is below the threshold' do
let(:active_user_count) { 1 }
it { is_expected.to eq(false) }
end
end
context 'with anonymous user' do
before do
allow(helper).to receive(:current_user).and_return(nil)
end
context 'when license is above the threshold' do
let(:active_user_count) { license_seats_limit + 5 }
it { is_expected.to be_falsey }
end
context 'when license is below the threshold' do
let(:active_user_count) { 1 }
it { is_expected.to be_falsey }
end
end
end
describe '#show_active_user_count_threshold_banner?' do describe '#show_active_user_count_threshold_banner?' do
let_it_be(:active_user_count) { 1 } let_it_be(:active_user_count) { 1 }
......
...@@ -14433,9 +14433,6 @@ msgstr "" ...@@ -14433,9 +14433,6 @@ msgstr ""
msgid "License|License" msgid "License|License"
msgstr "" msgstr ""
msgid "License|Licensed user count exceeded"
msgstr ""
msgid "License|You can restore access to the Gold features at any time by upgrading." msgid "License|You can restore access to the Gold features at any time by upgrading."
msgstr "" msgstr ""
...@@ -14451,9 +14448,6 @@ msgstr "" ...@@ -14451,9 +14448,6 @@ msgstr ""
msgid "License|Your free trial of GitLab Ultimate expired on %{trial_ends_on}." msgid "License|Your free trial of GitLab Ultimate expired on %{trial_ends_on}."
msgstr "" msgstr ""
msgid "License|Your instance has exceeded your subscription's number of licensed users by %{extra_users_count}. You can continue to add more users and we'll include the overage in your next bill."
msgstr ""
msgid "Limit display of time tracking units to hours." msgid "Limit display of time tracking units to hours."
msgstr "" msgstr ""
......
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