Commit d809683e authored by Vitaly Slobodin's avatar Vitaly Slobodin

Merge branch '323181-hide-renew-button-for-trail-subscriptions' into 'master'

Hide "Renew" button for trial subscription on group billing page

See merge request gitlab-org/gitlab!55796
parents 280776b4 cc32d425
...@@ -50,6 +50,9 @@ export default { ...@@ -50,6 +50,9 @@ export default {
return `${this.namespaceName}: ${planName} ${suffix}`; return `${this.namespaceName}: ${planName} ${suffix}`;
}, },
canRenew() {
return this.isSubscription && !this.plan.trial;
},
canUpgrade() { canUpgrade() {
return this.isFreePlan || this.plan.upgradable; return this.isFreePlan || this.plan.upgradable;
}, },
...@@ -78,7 +81,7 @@ export default { ...@@ -78,7 +81,7 @@ export default {
return this.canUpgradeEEPlan ? this.planUpgradeHref : this.customerPortalUrl; return this.canUpgradeEEPlan ? this.planUpgradeHref : this.customerPortalUrl;
}, },
renewButton() { renewButton() {
return this.isSubscription return this.canRenew
? createButtonProps(s__('SubscriptionTable|Renew'), this.planRenewHref, 'renew-button') ? createButtonProps(s__('SubscriptionTable|Renew'), this.planRenewHref, 'renew-button')
: null; : null;
}, },
......
---
title: Hide "Renew" button for trial subscription on group billing page
merge_request: 55796
author: Kev @KevSlashNull
type: fixed
...@@ -132,19 +132,21 @@ describe('SubscriptionTable component', () => { ...@@ -132,19 +132,21 @@ describe('SubscriptionTable component', () => {
describe('Renew button', () => { describe('Renew button', () => {
describe.each` describe.each`
planCode | expected | testDescription planCode | trial | expected | testDescription
${'silver'} | ${true} | ${'renders the button'} ${'silver'} | ${false} | ${true} | ${'renders the button'}
${null} | ${false} | ${'does not render the button'} ${'silver'} | ${true} | ${false} | ${'does not render the button'}
${'free'} | ${false} | ${'does not render the button'} ${null} | ${false} | ${false} | ${'does not render the button'}
${'free'} | ${false} | ${false} | ${'does not render the button'}
`( `(
'given a plan with state: planCode = $planCode', 'given a plan with state: planCode = $planCode, trial = $trial',
({ planCode, expected, testDescription }) => { ({ planCode, trial, expected, testDescription }) => {
beforeEach(() => { beforeEach(() => {
createComponentWithStore({ createComponentWithStore({
state: { state: {
isLoadingSubscription: false, isLoadingSubscription: false,
plan: { plan: {
code: planCode, code: planCode,
trial,
}, },
}, },
}); });
......
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