Commit 9c764c7f authored by Angelo Gulina's avatar Angelo Gulina Committed by Jan Provaznik

Remove `saas_add_seats_button` FF [RUN ALL RSPEC] [RUN AS-IF-FOSS]

parent 5492f611
---
name: saas_add_seats_button
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/49242
rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/291060
milestone: '13.7'
type: development
group: group::purchase
default_enabled: false
...@@ -4,7 +4,6 @@ import { escape } from 'lodash'; ...@@ -4,7 +4,6 @@ import { escape } from 'lodash';
import { mapActions, mapState, mapGetters } from 'vuex'; import { mapActions, mapState, mapGetters } from 'vuex';
import { TABLE_TYPE_DEFAULT, TABLE_TYPE_FREE, TABLE_TYPE_TRIAL } from 'ee/billings/constants'; import { TABLE_TYPE_DEFAULT, TABLE_TYPE_FREE, TABLE_TYPE_TRIAL } from 'ee/billings/constants';
import { s__ } from '~/locale'; import { s__ } from '~/locale';
import glFeatureFlagsMixin from '~/vue_shared/mixins/gl_feature_flags_mixin';
import SubscriptionTableRow from './subscription_table_row.vue'; import SubscriptionTableRow from './subscription_table_row.vue';
const createButtonProps = (text, href, testId) => ({ text, href, testId }); const createButtonProps = (text, href, testId) => ({ text, href, testId });
...@@ -16,7 +15,6 @@ export default { ...@@ -16,7 +15,6 @@ export default {
GlLoadingIcon, GlLoadingIcon,
SubscriptionTableRow, SubscriptionTableRow,
}, },
mixins: [glFeatureFlagsMixin()],
inject: { inject: {
planUpgradeHref: { planUpgradeHref: {
default: '', default: '',
...@@ -43,26 +41,23 @@ export default { ...@@ -43,26 +41,23 @@ export default {
computed: { computed: {
...mapState(['isLoadingSubscription', 'hasErrorSubscription', 'plan', 'tables', 'endpoint']), ...mapState(['isLoadingSubscription', 'hasErrorSubscription', 'plan', 'tables', 'endpoint']),
...mapGetters(['isFreePlan']), ...mapGetters(['isFreePlan']),
isSubscription() {
return !this.isFreePlan;
},
subscriptionHeader() { subscriptionHeader() {
const planName = this.isFreePlan ? s__('SubscriptionTable|Free') : escape(this.planName); const planName = this.isFreePlan ? s__('SubscriptionTable|Free') : escape(this.planName);
const suffix = !this.isFreePlan && this.plan.trial ? s__('SubscriptionTable|Trial') : ''; const suffix = this.isSubscription && this.plan.trial ? s__('SubscriptionTable|Trial') : '';
return `${this.namespaceName}: ${planName} ${suffix}`; return `${this.namespaceName}: ${planName} ${suffix}`;
}, },
canAddSeats() {
return this.glFeatures.saasAddSeatsButton && !this.isFreePlan;
},
canRenew() {
return !this.isFreePlan;
},
canUpgrade() { canUpgrade() {
return this.isFreePlan || this.plan.upgradable; return this.isFreePlan || this.plan.upgradable;
}, },
canUpgradeEEPlan() { canUpgradeEEPlan() {
return !this.isFreePlan && this.planUpgradeHref; return this.isSubscription && this.planUpgradeHref;
}, },
addSeatsButton() { addSeatsButton() {
return this.canAddSeats return this.isSubscription
? createButtonProps( ? createButtonProps(
s__('SubscriptionTable|Add seats'), s__('SubscriptionTable|Add seats'),
this.addSeatsHref, this.addSeatsHref,
...@@ -83,12 +78,12 @@ export default { ...@@ -83,12 +78,12 @@ export default {
return this.canUpgradeEEPlan ? this.planUpgradeHref : this.customerPortalUrl; return this.canUpgradeEEPlan ? this.planUpgradeHref : this.customerPortalUrl;
}, },
renewButton() { renewButton() {
return this.canRenew return this.isSubscription
? createButtonProps(s__('SubscriptionTable|Renew'), this.planRenewHref, 'renew-button') ? createButtonProps(s__('SubscriptionTable|Renew'), this.planRenewHref, 'renew-button')
: null; : null;
}, },
manageButton() { manageButton() {
return !this.isFreePlan return this.isSubscription
? createButtonProps( ? createButtonProps(
s__('SubscriptionTable|Manage'), s__('SubscriptionTable|Manage'),
this.customerPortalUrl, this.customerPortalUrl,
......
...@@ -4,10 +4,6 @@ class Groups::BillingsController < Groups::ApplicationController ...@@ -4,10 +4,6 @@ class Groups::BillingsController < Groups::ApplicationController
before_action :authorize_admin_group! before_action :authorize_admin_group!
before_action :verify_namespace_plan_check_enabled before_action :verify_namespace_plan_check_enabled
before_action only: [:index] do
push_frontend_feature_flag(:saas_add_seats_button)
end
layout 'group_settings' layout 'group_settings'
feature_category :purchase feature_category :purchase
......
---
title: Show 'Add Seats' Button on Billing Page
merge_request: 55964
author:
type: added
...@@ -75,19 +75,6 @@ RSpec.describe 'Groups > Billing', :js do ...@@ -75,19 +75,6 @@ RSpec.describe 'Groups > Billing', :js do
expect(page).to have_link("See usage", href: group_seat_usage_path(group)) expect(page).to have_link("See usage", href: group_seat_usage_path(group))
end end
end end
context 'with disabled feature flags' do
before do
stub_feature_flags(saas_add_seats_button: false)
visit group_billings_path(group)
end
it 'does not show "Add Seats" button' do
within subscription_table do
expect(page).not_to have_link("Add seats")
end
end
end
end end
context 'with a legacy paid plan' do context 'with a legacy paid plan' do
...@@ -107,32 +94,4 @@ RSpec.describe 'Groups > Billing', :js do ...@@ -107,32 +94,4 @@ RSpec.describe 'Groups > Billing', :js do
end end
end end
end end
context 'with feature flags' do
where(:saas_add_seats_button) do
[
true, false
]
end
let(:plan) { 'bronze' }
let_it_be(:subscription) do
create(:gitlab_subscription, namespace: group, hosted_plan: bronze_plan, seats: 15)
end
with_them do
before do
stub_feature_flags(saas_add_seats_button: saas_add_seats_button)
end
it 'pushes the correct feature flags' do
visit group_billings_path(group)
expect(page).to have_pushed_frontend_feature_flags(
saasAddSeatsButton: saas_add_seats_button
)
end
end
end
end end
...@@ -19,19 +19,12 @@ describe('SubscriptionTable component', () => { ...@@ -19,19 +19,12 @@ describe('SubscriptionTable component', () => {
let store; let store;
let wrapper; let wrapper;
const defaultFlags = { saasAddSeatsButton: false };
const findAddSeatsButton = () => wrapper.findByTestId('add-seats-button'); const findAddSeatsButton = () => wrapper.findByTestId('add-seats-button');
const findManageButton = () => wrapper.findByTestId('manage-button'); const findManageButton = () => wrapper.findByTestId('manage-button');
const findRenewButton = () => wrapper.findByTestId('renew-button'); const findRenewButton = () => wrapper.findByTestId('renew-button');
const findUpgradeButton = () => wrapper.findByTestId('upgrade-button'); const findUpgradeButton = () => wrapper.findByTestId('upgrade-button');
const createComponentWithStore = ({ const createComponentWithStore = ({ props = {}, provide = {}, state = {} } = {}) => {
props = {},
featureFlags = {},
provide = {},
state = {},
} = {}) => {
store = new Vuex.Store(initialStore()); store = new Vuex.Store(initialStore());
jest.spyOn(store, 'dispatch').mockImplementation(); jest.spyOn(store, 'dispatch').mockImplementation();
...@@ -44,10 +37,6 @@ describe('SubscriptionTable component', () => { ...@@ -44,10 +37,6 @@ describe('SubscriptionTable component', () => {
namespaceName, namespaceName,
planName, planName,
...provide, ...provide,
glFeatures: {
defaultFlags,
...featureFlags,
},
}, },
propsData: props, propsData: props,
}), }),
...@@ -120,7 +109,7 @@ describe('SubscriptionTable component', () => { ...@@ -120,7 +109,7 @@ describe('SubscriptionTable component', () => {
${null} | ${false} | ${'does not render the button'} ${null} | ${false} | ${'does not render the button'}
${'free'} | ${false} | ${'does not render the button'} ${'free'} | ${false} | ${'does not render the button'}
`( `(
'given a plan with state: planCode = $planCode and saasAddSeatsButton = $featureFlag', 'given a plan with state: planCode = $planCode',
({ planCode, upgradable, expected, testDescription }) => { ({ planCode, upgradable, expected, testDescription }) => {
beforeEach(() => { beforeEach(() => {
createComponentWithStore({ createComponentWithStore({
...@@ -170,19 +159,15 @@ describe('SubscriptionTable component', () => { ...@@ -170,19 +159,15 @@ describe('SubscriptionTable component', () => {
describe('Add seats button', () => { describe('Add seats button', () => {
describe.each` describe.each`
planCode | featureFlag | expected | testDescription planCode | expected | testDescription
${'silver'} | ${true} | ${true} | ${'renders the button'} ${'silver'} | ${true} | ${'renders the button'}
${'silver'} | ${false} | ${false} | ${'does not render the button'} ${null} | ${false} | ${'does not render the button'}
${null} | ${true} | ${false} | ${'does not render the button'} ${'free'} | ${false} | ${'does not render the button'}
${null} | ${false} | ${false} | ${'does not render the button'}
${'free'} | ${true} | ${false} | ${'does not render the button'}
${'free'} | ${false} | ${false} | ${'does not render the button'}
`( `(
'given a plan with state: planCode = $planCode and saasAddSeatsButton = $featureFlag', 'given a plan with state: planCode = $planCode',
({ planCode, featureFlag, expected, testDescription }) => { ({ planCode, expected, testDescription }) => {
beforeEach(() => { beforeEach(() => {
createComponentWithStore({ createComponentWithStore({
featureFlags: { saasAddSeatsButton: featureFlag },
state: { state: {
isLoadingSubscription: false, isLoadingSubscription: false,
plan: { plan: {
......
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