0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-01-27 22:49:56 -05:00

Updated last4 to return masked value if empty in theme

closes https://github.com/TryGhost/Team/issues/464

Currently, if the last4 value for a customer is empty, we end up showing `null` in theme where the card details are shown. The fix updates the last4 to return a masked value of **** instead of null if it's empty, ensuring themes using the last4 values don't have a `null` value shown to the user.
This commit is contained in:
Rish 2021-02-24 14:24:54 +05:30 committed by Rishabh Garg
parent 67bf3a77c1
commit 1a44221df1

View file

@ -173,7 +173,11 @@ function updateLocalTemplateOptions(req, res, next) {
name: req.member.name,
firstname: req.member.name && req.member.name.split(' ')[0],
avatar_image: req.member.avatar_image,
subscriptions: req.member.subscriptions,
subscriptions: req.member.subscriptions && req.member.subscriptions.map((sub) => {
return Object.assign({}, sub, {
default_payment_card_last4: sub.default_payment_card_last4 || '****'
});
}),
paid: req.member.status === 'paid'
} : null;