Ghost/core/server/data/schema/checks.js
Aileen Nowak 19167c1af2 🐛 Fixed author helper not returning the correct url (#9102)
closes #9101

With 506a0c3e9e we don't expose the `status` field for author context anymore, which is used to determine the correct URL for the `{{url}}` helper in https://github.com/TryGhost/Ghost/blob/master/core/server/data/schema/checks.js#L13

This fix uses the field `profile_image` instead and adds a missing test for author context to the `{{url}}` helper test.
2017-10-05 13:50:55 +02:00

27 lines
840 B
JavaScript

function isPost(jsonData) {
return jsonData.hasOwnProperty('html') &&
jsonData.hasOwnProperty('title') && jsonData.hasOwnProperty('slug');
}
function isTag(jsonData) {
return jsonData.hasOwnProperty('name') && jsonData.hasOwnProperty('slug') &&
jsonData.hasOwnProperty('description') && jsonData.hasOwnProperty('parent');
}
function isUser(jsonData) {
return jsonData.hasOwnProperty('bio') && jsonData.hasOwnProperty('website') &&
jsonData.hasOwnProperty('profile_image') && jsonData.hasOwnProperty('location');
}
function isNav(jsonData) {
return jsonData.hasOwnProperty('label') && jsonData.hasOwnProperty('url') &&
jsonData.hasOwnProperty('slug') && jsonData.hasOwnProperty('current');
}
module.exports = {
isPost: isPost,
isTag: isTag,
isUser: isUser,
isNav: isNav
};