fix: draftAndPublish default to false

This commit is contained in:
Alexandre Bodin 2024-03-15 11:10:44 +01:00
parent fc9cfcfff7
commit 45c1c52b0b

View File

@ -109,9 +109,9 @@ const isVisibleAttribute = (model: Model, attributeName: string) => {
};
const getOptions = (model: Model) =>
_.assign({ draftAndPublish: true }, _.get(model, 'options', {}));
_.assign({ draftAndPublish: false }, _.get(model, 'options', {}));
const hasDraftAndPublish = (model: Model) => _.get(model, 'options.draftAndPublish', true) === true;
const hasDraftAndPublish = (model: Model) => _.get(model, 'options.draftAndPublish', false) === true;
const isDraft = <T extends object>(data: T, model: Model) =>
hasDraftAndPublish(model) && _.get(data, PUBLISHED_AT_ATTRIBUTE) === null;