mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-02-17 23:44:39 -05:00
Fixed archived offers incorrectly showing offer page
refs https://github.com/TryGhost/Team/issues/1269 - accessing an archived offer url was incorrectly showing the offer page, as we were not checking for the status of offer - the archived offer redemption was working correctly as it was blocked on API, this change updates the ui to hide offer screen for archived as well
This commit is contained in:
parent
e47a24f362
commit
b659996082
2 changed files with 6 additions and 2 deletions
|
@ -10,7 +10,7 @@ import * as Fixtures from './utils/fixtures';
|
|||
import ActionHandler from './actions';
|
||||
import './App.css';
|
||||
import NotificationParser from './utils/notifications';
|
||||
import {createPopupNotification, getCurrencySymbol, getFirstpromoterId, getPriceIdFromPageQuery, getProductFromId, getQueryPrice, getSiteDomain, isComplimentaryMember, isInviteOnlySite, isPaidMember, isSentryEventAllowed, removePortalLinkFromUrl} from './utils/helpers';
|
||||
import {createPopupNotification, getCurrencySymbol, getFirstpromoterId, getPriceIdFromPageQuery, getProductFromId, getQueryPrice, getSiteDomain, isActiveOffer, isComplimentaryMember, isInviteOnlySite, isPaidMember, isSentryEventAllowed, removePortalLinkFromUrl} from './utils/helpers';
|
||||
|
||||
const handleDataAttributes = require('./data-attributes');
|
||||
const React = require('react');
|
||||
|
@ -576,7 +576,7 @@ export default class App extends React.Component {
|
|||
try {
|
||||
const offerData = await this.GhostApi.site.offer({offerId});
|
||||
const offer = offerData?.offers[0];
|
||||
if (offer) {
|
||||
if (isActiveOffer({offer})) {
|
||||
if (!portalButton) {
|
||||
const product = getProductFromId({site, productId: offer.tier.id});
|
||||
const price = offer.cadence === 'month' ? product.monthlyPrice : product.yearlyPrice;
|
||||
|
|
|
@ -528,3 +528,7 @@ export const getUpdatedOfferPrice = ({offer, price, useFormatted = false}) => {
|
|||
}
|
||||
return updatedAmount;
|
||||
};
|
||||
|
||||
export const isActiveOffer = ({offer}) => {
|
||||
return offer?.status === 'active';
|
||||
};
|
||||
|
|
Loading…
Add table
Reference in a new issue