Commit e9f85a9f authored by Alex Kalderimis's avatar Alex Kalderimis

Merge branch...

Merge branch '352057-remove-upgrade-item-in-top-right-profile-dropdown-for-premium-saas-customers' into 'master'

Remove "Upgrade 🚀" item in top-right profile dropdown

See merge request gitlab-org/gitlab!84392
parents 0977fea7 b7102280
......@@ -95,15 +95,10 @@ function trackShowUserDropdownLink(trackEvent, elToTrack, el) {
export function initNavUserDropdownTracking() {
const el = document.querySelector('.js-nav-user-dropdown');
const buyEl = document.querySelector('.js-buy-pipeline-minutes-link');
const upgradeEl = document.querySelector('.js-upgrade-plan-link');
if (el && buyEl) {
trackShowUserDropdownLink('show_buy_ci_minutes', buyEl, el);
}
if (el && upgradeEl) {
trackShowUserDropdownLink('show_upgrade_link', upgradeEl, el);
}
}
requestIdleCallback(initStatusTriggers);
......
......@@ -458,7 +458,6 @@
vertical-align: text-top;
}
a.upgrade-plan-link gl-emoji,
a.ci-minutes-emoji gl-emoji,
a.trial-link gl-emoji {
font-size: $gl-font-size;
......
......@@ -27,7 +27,6 @@
%li
= link_to s_("CurrentUser|Preferences"), profile_preferences_path
= render_if_exists 'layouts/header/buy_pipeline_minutes', project: @project, namespace: @group
= render_if_exists 'layouts/header/upgrade'
- if current_user_menu?(:help)
%li.divider.d-md-none
......
......@@ -30,15 +30,6 @@ module EE
end
end
def show_upgrade_link?(user)
return unless user
return unless ::Gitlab.com?
Rails.cache.fetch(['users', user.id, 'show_upgrade_link?'], expires_in: 10.minutes) do
user.owns_upgradeable_namespace?
end
end
private
def trials_allowed?(user)
......
......@@ -365,11 +365,6 @@ module EE
InstanceSecurityDashboard.new(self)
end
def owns_upgradeable_namespace?
!owns_paid_namespace?(plans: [::Plan::GOLD, ::Plan::ULTIMATE]) &&
owns_paid_namespace?(plans: [::Plan::BRONZE, ::Plan::SILVER, ::Plan::PREMIUM])
end
# Returns the groups a user has access to, either through a membership or a project authorization
override :authorized_groups
def authorized_groups(with_minimal_access: true)
......
- if show_upgrade_link?(current_user)
%li
= link_to Gitlab::Saas.about_pricing_url,
class: 'upgrade-plan-link js-upgrade-plan-link',
data: { 'track-action': 'click_upgrade_link', 'track-label': current_user.namespace.actual_plan_name, 'track-property': 'user_dropdown' } do
= s_("CurrentUser|Upgrade")
= emoji_icon('rocket', 'aria-hidden': true)
......@@ -1607,51 +1607,6 @@ RSpec.describe User do
end
end
describe '#owns_upgradeable_namespace?', :saas do
let_it_be(:user) { create(:user) }
subject { user.owns_upgradeable_namespace? }
using RSpec::Parameterized::TableSyntax
where(:hosted_plan, :result) do
:bronze_plan | true
:premium_plan | true
:ultimate_plan | false
:free_plan | false
:default_plan | false
end
with_them do
it 'returns the correct result for each plan on a personal namespace' do
plan = create(hosted_plan) # rubocop:disable Rails/SaveBang
create(:gitlab_subscription, namespace: user.namespace, hosted_plan: plan)
expect(subject).to be result
end
it 'returns the correct result for each plan on a group owned by the user' do
create(:group_with_plan, plan: hosted_plan).add_owner(user)
expect(subject).to be result
end
end
it 'returns false when there is no subscription for the personal namespace' do
expect(subject).to be false
end
it 'returns false when the user has multiple groups and any group has ultimate' do
create(:group_with_plan, plan: :bronze_plan).add_owner(user)
create(:group_with_plan, plan: :premium_plan).add_owner(user)
create(:group_with_plan, plan: :ultimate_plan).add_owner(user)
user.namespace.plans.reload
expect(subject).to be false
end
end
describe '#find_or_init_board_epic_preference' do
let_it_be(:user) { create(:user) }
let_it_be(:board) { create(:board) }
......
......@@ -12,7 +12,6 @@ RSpec.describe 'layouts/header/_current_user_dropdown' do
before do
allow(view).to receive(:current_user).and_return(user)
allow(view).to receive(:show_upgrade_link?).and_return(false)
allow(view).to receive(:show_buy_pipeline_minutes?).and_return(need_minutes)
allow(view).to receive(:show_pipeline_minutes_notification_dot?).and_return(show_notification_dot)
allow(view).to receive(:show_buy_pipeline_with_subtext?).and_return(show_subtext)
......@@ -65,32 +64,4 @@ RSpec.describe 'layouts/header/_current_user_dropdown' do
end
end
end
describe 'Upgrade link in user dropdown' do
let(:on_upgradeable_plan) { true }
before do
allow(view).to receive(:current_user).and_return(user)
allow(view).to receive(:show_buy_pipeline_minutes?).and_return(false)
allow(view).to receive(:show_upgrade_link?).and_return(on_upgradeable_plan)
render
end
subject { rendered }
context 'when user is on an upgradeable plan' do
it 'displays the Upgrade link' do
expect(subject).to have_link('Upgrade')
end
end
context 'when user is not on an upgradeable plan' do
let(:on_upgradeable_plan) { false }
it 'does not display the Upgrade link' do
expect(subject).not_to have_link('Upgrade')
end
end
end
end
......@@ -10951,9 +10951,6 @@ msgstr ""
msgid "CurrentUser|Start an Ultimate trial"
msgstr ""
msgid "CurrentUser|Upgrade"
msgstr ""
msgid "Custom Attributes"
msgstr ""
......
......@@ -60,7 +60,6 @@ describe('Header', () => {
setFixtures(`
<li class="js-nav-user-dropdown">
<a class="js-buy-pipeline-minutes-link" data-track-action="click_buy_ci_minutes" data-track-label="free" data-track-property="user_dropdown">Buy Pipeline minutes</a>
<a class="js-upgrade-plan-link" data-track-action="click_upgrade_link" data-track-label="free" data-track-property="user_dropdown">Upgrade</a>
</li>`);
trackingSpy = mockTracking('_category_', $('.js-nav-user-dropdown').element, jest.spyOn);
......@@ -81,14 +80,5 @@ describe('Header', () => {
property: 'user_dropdown',
});
});
it('sends a tracking event when the dropdown is opened and contains Upgrade link', () => {
$('.js-nav-user-dropdown').trigger('shown.bs.dropdown');
expect(trackingSpy).toHaveBeenCalledWith('some:page', 'show_upgrade_link', {
label: 'free',
property: 'user_dropdown',
});
});
});
});
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