mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-19 16:42:17 +03:00
192ebb1739
refs #9178 - move tests as well
21 lines
659 B
JavaScript
21 lines
659 B
JavaScript
var settingsCache = require('../../services/settings/cache'),
|
|
_ = require('lodash');
|
|
|
|
function getContextObject(data, context) {
|
|
/**
|
|
* If the data object does not contain the requested context, we return the fallback object.
|
|
*/
|
|
var blog = {
|
|
cover_image: settingsCache.get('cover_image'),
|
|
twitter: settingsCache.get('twitter'),
|
|
facebook: settingsCache.get('facebook')
|
|
},
|
|
contextObject;
|
|
|
|
context = _.includes(context, 'page') || _.includes(context, 'amp') ? 'post' : context;
|
|
contextObject = data[context] || blog;
|
|
return contextObject;
|
|
}
|
|
|
|
module.exports = getContextObject;
|