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) { ...@@ -95,15 +95,10 @@ function trackShowUserDropdownLink(trackEvent, elToTrack, el) {
export function initNavUserDropdownTracking() { export function initNavUserDropdownTracking() {
const el = document.querySelector('.js-nav-user-dropdown'); const el = document.querySelector('.js-nav-user-dropdown');
const buyEl = document.querySelector('.js-buy-pipeline-minutes-link'); const buyEl = document.querySelector('.js-buy-pipeline-minutes-link');
const upgradeEl = document.querySelector('.js-upgrade-plan-link');
if (el && buyEl) { if (el && buyEl) {
trackShowUserDropdownLink('show_buy_ci_minutes', buyEl, el); trackShowUserDropdownLink('show_buy_ci_minutes', buyEl, el);
} }
if (el && upgradeEl) {
trackShowUserDropdownLink('show_upgrade_link', upgradeEl, el);
}
} }
requestIdleCallback(initStatusTriggers); requestIdleCallback(initStatusTriggers);
......
...@@ -458,7 +458,6 @@ ...@@ -458,7 +458,6 @@
vertical-align: text-top; vertical-align: text-top;
} }
a.upgrade-plan-link gl-emoji,
a.ci-minutes-emoji gl-emoji, a.ci-minutes-emoji gl-emoji,
a.trial-link gl-emoji { a.trial-link gl-emoji {
font-size: $gl-font-size; font-size: $gl-font-size;
......
...@@ -27,7 +27,6 @@ ...@@ -27,7 +27,6 @@
%li %li
= link_to s_("CurrentUser|Preferences"), profile_preferences_path = 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/buy_pipeline_minutes', project: @project, namespace: @group
= render_if_exists 'layouts/header/upgrade'
- if current_user_menu?(:help) - if current_user_menu?(:help)
%li.divider.d-md-none %li.divider.d-md-none
......
...@@ -30,15 +30,6 @@ module EE ...@@ -30,15 +30,6 @@ module EE
end end
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 private
def trials_allowed?(user) def trials_allowed?(user)
......
...@@ -365,11 +365,6 @@ module EE ...@@ -365,11 +365,6 @@ module EE
InstanceSecurityDashboard.new(self) InstanceSecurityDashboard.new(self)
end 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 # Returns the groups a user has access to, either through a membership or a project authorization
override :authorized_groups override :authorized_groups
def authorized_groups(with_minimal_access: true) 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 ...@@ -1607,51 +1607,6 @@ RSpec.describe User do
end end
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 describe '#find_or_init_board_epic_preference' do
let_it_be(:user) { create(:user) } let_it_be(:user) { create(:user) }
let_it_be(:board) { create(:board) } let_it_be(:board) { create(:board) }
......
...@@ -12,7 +12,6 @@ RSpec.describe 'layouts/header/_current_user_dropdown' do ...@@ -12,7 +12,6 @@ RSpec.describe 'layouts/header/_current_user_dropdown' do
before do before do
allow(view).to receive(:current_user).and_return(user) 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_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_pipeline_minutes_notification_dot?).and_return(show_notification_dot)
allow(view).to receive(:show_buy_pipeline_with_subtext?).and_return(show_subtext) 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 ...@@ -65,32 +64,4 @@ RSpec.describe 'layouts/header/_current_user_dropdown' do
end end
end 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 end
...@@ -10951,9 +10951,6 @@ msgstr "" ...@@ -10951,9 +10951,6 @@ msgstr ""
msgid "CurrentUser|Start an Ultimate trial" msgid "CurrentUser|Start an Ultimate trial"
msgstr "" msgstr ""
msgid "CurrentUser|Upgrade"
msgstr ""
msgid "Custom Attributes" msgid "Custom Attributes"
msgstr "" msgstr ""
......
...@@ -60,7 +60,6 @@ describe('Header', () => { ...@@ -60,7 +60,6 @@ describe('Header', () => {
setFixtures(` setFixtures(`
<li class="js-nav-user-dropdown"> <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-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>`); </li>`);
trackingSpy = mockTracking('_category_', $('.js-nav-user-dropdown').element, jest.spyOn); trackingSpy = mockTracking('_category_', $('.js-nav-user-dropdown').element, jest.spyOn);
...@@ -81,14 +80,5 @@ describe('Header', () => { ...@@ -81,14 +80,5 @@ describe('Header', () => {
property: 'user_dropdown', 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