0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-01-06 22:40:14 -05:00

🐛 Fixed incorrect @price.currency value in themes (#12987)

closes https://github.com/TryGhost/Ghost/issues/12986
refs 1345268089

As part of changes in 4.6, the default price ids for monthly/yearly prices are stored in new settings - `members_monthly_price_id`, `members_yearly_price_id` - which are used to determine current active prices for the site from list of all existing prices. While the last commit updated the prices to use the settings, the data for currency was still used from non-zero prices instead of the new settings value.

- Updated tests to check price currency
This commit is contained in:
Rishabh Garg 2021-05-27 10:49:35 +05:30 committed by GitHub
parent 1cbd14b376
commit 36803a4290
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 7 additions and 7 deletions

View file

@ -98,7 +98,7 @@ async function haxGetMembersPriceData() {
const priceData = {
monthly: makePriceObject(monthlyPrice || defaultPrice),
yearly: makePriceObject(yearlyPrice || defaultPrice),
currency: nonZeroPrices[0].currency
currency: monthlyPrice ? monthlyPrice.currency : defaultPrice.currency
};
return priceData;

View file

@ -130,8 +130,8 @@ describe('Front-end members behaviour', function () {
// Check out test/utils/fixtures/themes/price-data-test-theme/index.hbs
// To see where this is coming from.
//
const legacyUse = /You can use the price data as a number: 12/;
const withPriceHelper = /You can pass price data to the price helper: \$12/;
const legacyUse = /You can use the price data as a number and currency: £12/;
const withPriceHelper = /You can pass price data to the price helper: £12/;
should.exist(res.text.match(legacyUse));
should.exist(res.text.match(withPriceHelper));

View file

@ -497,7 +497,7 @@ DataGenerator.Content = {
stripe_product_id: '109c85c734fb9992e7bc30a26af66c22f5c94d8dc62e0a33cb797be902c06b2d',
active: true,
nickname: 'Monthly',
currency: 'USD',
currency: 'GBP',
amount: 1200,
type: 'recurring',
interval: 'month'
@ -508,7 +508,7 @@ DataGenerator.Content = {
stripe_product_id: '109c85c734fb9992e7bc30a26af66c22f5c94d8dc62e0a33cb797be902c06b2d',
active: true,
nickname: 'Yearly',
currency: 'USD',
currency: 'GBP',
amount: 12000,
type: 'recurring',
interval: 'year'
@ -519,7 +519,7 @@ DataGenerator.Content = {
stripe_product_id: '109c85c734fb9992e7bc30a26af66c22f5c94d8dc62e0a33cb797be902c06b2d',
active: true,
nickname: 'Yearly',
currency: 'USD',
currency: 'GBP',
amount: 15000,
type: 'recurring',
interval: 'year'

View file

@ -1,5 +1,5 @@
<p class="number">
You can use the price data as a number: {{@price.monthly}}
You can use the price data as a number and currency: {{price currency=@price.currency}}{{@price.monthly}}
</p>
<p class="with-price-helper">
You can pass price data to the price helper: {{price @price.monthly}}