Allowed for OfferDescription to be null/empty
refs https://github.com/TryGhost/Team/issues/1083 OfferDescription is not a required field, so we must not throw when it is falsy or not present.
This commit is contained in:
parent
35f150bcf4
commit
08d3e6e99c
@ -5,7 +5,11 @@ const InvalidOfferDescription = require('../errors').InvalidOfferDescription;
|
||||
class OfferDescription extends ValueObject {
|
||||
/** @param {unknown} description */
|
||||
static create(description) {
|
||||
if (!description || typeof description !== 'string') {
|
||||
if (description === null || description === undefined) {
|
||||
return new OfferDescription('');
|
||||
}
|
||||
|
||||
if (typeof description !== 'string') {
|
||||
throw new InvalidOfferDescription({
|
||||
message: 'Offer `display_description` must be a string.'
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user