mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-24 03:14:03 +03:00
af4bfb8862
- purely for cleanliness! - we use kebabcase by default - tests should be kebab-case-file_spec.js (one day we want this to be .test.js)
16 lines
610 B
JavaScript
16 lines
610 B
JavaScript
const urlUtils = require('../../shared/url-utils');
|
|
const getContextObject = require('./context-object.js');
|
|
const _ = require('lodash');
|
|
|
|
function getAuthorImage(data, absolute) {
|
|
const context = data.context ? data.context : null;
|
|
const contextObject = getContextObject(data, context);
|
|
|
|
if ((_.includes(context, 'post') || _.includes(context, 'page')) && contextObject.primary_author && contextObject.primary_author.profile_image) {
|
|
return urlUtils.urlFor('image', {image: contextObject.primary_author.profile_image}, absolute);
|
|
}
|
|
return null;
|
|
}
|
|
|
|
module.exports = getAuthorImage;
|