0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-02-24 23:48:13 -05:00

🐛 Fixed missing complimentary subscription add button

refs 81de2fe223
refs https://github.com/TryGhost/Team/issues/758

The "Add complimentary" subscription button in members does not show up when members already have an existing zero amount subscription. But this was incorrectly not taking into account active subscriptions and was applying the rule to canceled subscriptions. Since the `comped` behaviour changed in 4.6 which caused member's existing comp subscription to be canceled, this bug did not allow the comped subscription to be added back.
This commit is contained in:
Rishabh 2021-06-07 22:03:04 +05:30 committed by Rishabh Garg
parent 0fb9417ed5
commit 1bfd37d24c

View file

@ -31,7 +31,9 @@ export default class extends Component {
get isAddComplimentaryAllowed() {
let subscriptions = this.member.get('subscriptions') || [];
const hasZeroPriceSub = subscriptions.find((sub) => {
const hasZeroPriceSub = subscriptions.filter((sub) => {
return ['active', 'trialing', 'unpaid', 'past_due'].includes(sub.status);
}).find((sub) => {
return !sub?.price?.amount;
});
return !hasZeroPriceSub;