0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-03-11 02:12:21 -05:00

Fixed issue with updating offer to empty description

no-issue

Because we were checking for truthyness rather than existence when
updating properties on an Offer - it was impossible to set the
description to a blank string, as this is falsy.
This commit is contained in:
Fabien O'Carroll 2021-10-19 11:00:18 +02:00
parent 8d544978eb
commit e744c0f82e

View file

@ -67,27 +67,27 @@ class OffersAPI {
const offer = await this.repository.getById(data.id, options);
if (data.name) {
if (Reflect.has(data, 'name')) {
const name = OfferName.create(data.name);
await offer.updateName(name, uniqueChecker);
}
if (data.code) {
if (Reflect.has(data, 'code')) {
const code = OfferCode.create(data.code);
await offer.updateCode(code, uniqueChecker);
}
if (data.display_title) {
if (Reflect.has(data, 'display_title')) {
const title = OfferTitle.create(data.display_title);
offer.displayTitle = title;
}
if (data.display_description) {
if (Reflect.has(data, 'display_description')) {
const description = OfferDescription.create(data.display_description);
offer.displayDescription = description;
}
if (data.status) {
if (Reflect.has(data, 'status')) {
const status = OfferStatus.create(data.status);
offer.status = status;
}