mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-02-10 23:36:14 -05:00
Used current time for created_at for missing events
refs https://github.com/TryGhost/Team/issues/873 This is an unexpected state, but possible if the alpha version of tier has been enabled previous to the events being added.
This commit is contained in:
parent
40699893ba
commit
3a91687b08
1 changed files with 4 additions and 2 deletions
|
@ -39,10 +39,12 @@ module.exports = class MemberBREADService {
|
|||
for (const product of member.products) {
|
||||
if (!subscriptionProducts.includes(product.id)) {
|
||||
const productAddEvent = member.productEvents.find(event => event.product_id === product.id);
|
||||
let startDate;
|
||||
if (!productAddEvent || productAddEvent.action !== 'added') {
|
||||
// There's something very wrong here. They have been comped this product - why is there no event????
|
||||
startDate = moment();
|
||||
} else {
|
||||
startDate = moment(productAddEvent.created_at);
|
||||
}
|
||||
const startDate = moment(productAddEvent.created_at);
|
||||
member.subscriptions.push({
|
||||
id: '',
|
||||
customer: {
|
||||
|
|
Loading…
Add table
Reference in a new issue