mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-11-27 10:42:45 +03:00
Added support for the active flag to Products API
refs https://github.com/TryGhost/Team/issues/1252 This will be used to archive and unarchive Tiers. There is a restriction on archiving "free" Tiers because our current system expects only one, and it should always be active.
This commit is contained in:
parent
233bb828fa
commit
c59a42c87b
@ -134,6 +134,7 @@ class ProductRepository {
|
|||||||
|
|
||||||
const productData = {
|
const productData = {
|
||||||
type: 'paid',
|
type: 'paid',
|
||||||
|
active: true,
|
||||||
name: data.name,
|
name: data.name,
|
||||||
description: data.description,
|
description: data.description,
|
||||||
benefits: data.benefits
|
benefits: data.benefits
|
||||||
@ -277,8 +278,13 @@ class ProductRepository {
|
|||||||
benefits: data.benefits
|
benefits: data.benefits
|
||||||
};
|
};
|
||||||
|
|
||||||
|
if (Reflect.has(data, 'active')) {
|
||||||
|
productData.active = data.active;
|
||||||
|
}
|
||||||
|
|
||||||
if (existingProduct.get('type') === 'free') {
|
if (existingProduct.get('type') === 'free') {
|
||||||
delete productData.name;
|
delete productData.name;
|
||||||
|
delete productData.active;
|
||||||
}
|
}
|
||||||
|
|
||||||
let product = await this._Product.edit(productData, {
|
let product = await this._Product.edit(productData, {
|
||||||
|
Loading…
Reference in New Issue
Block a user