0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-02-24 23:48:13 -05:00

Added clarifying comment to the email_only mapping

https://github.com/TryGhost/Team/issues/893

- The assignment is not that obvious and might be confusing without wider context, which is why it warrants to have a clarifying comment. This became apparent during code review
This commit is contained in:
Naz 2021-08-05 10:55:40 +04:00 committed by naz
parent 838e94e535
commit 8b5d0f559d

View file

@ -52,6 +52,9 @@ const mapPost = (model, frame) => {
_(metaAttrs).filter((k) => {
return (!frame.options.columns || (frame.options.columns && frame.options.columns.includes(k)));
}).each((attr) => {
// NOTE: the default of `email_only` is `false` which is why we default to `false` instead of `null`
// The undefined value is possible because `posts_meta` table is lazily created only one of the
// values is assigned.
const defaultValue = (attr === 'email_only') ? false : null;
jsonModel[attr] = _.get(jsonModel.posts_meta, attr) || defaultValue;
});