Added missing page prop to v2 Content API posts

no-issue

We have to wrap this in a check to make sure that `page` property is
only returned if either:
A) No `fields` param is passed (send back all fields)
B) `fields` param is passed AND it includes the `page` field
This commit is contained in:
Fabien O'Carroll 2019-10-16 15:20:21 +07:00
parent 38a05c0393
commit 7c4f177fee

View File

@ -37,8 +37,12 @@ const mapPost = (model, frame) => {
if (utils.isContentAPI(frame)) {
// Content api v2 still expects page prop
if (jsonModel.type === 'page') {
jsonModel.page = true;
if (!frame.options.columns || frame.options.columns.includes('page')) {
if (jsonModel.type === 'page') {
jsonModel.page = true;
} else {
jsonModel.page = false;
}
}
date.forPost(jsonModel);
members.forPost(jsonModel, frame);