mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-25 11:55:03 +03:00
parent
56db4ddd75
commit
95b5fb1c81
@ -26,6 +26,7 @@ _private.settingsFilter = (settings, filter) => {
|
||||
module.exports = {
|
||||
browse(models, apiConfig, frame) {
|
||||
let filteredSettings;
|
||||
|
||||
// If this is public, we already have the right data, we just need to add an Array wrapper
|
||||
if (utils.isContentAPI(frame)) {
|
||||
filteredSettings = models;
|
||||
|
@ -1,3 +1,4 @@
|
||||
const _ = require('lodash');
|
||||
const urlService = require('../../../../../../services/url');
|
||||
|
||||
const forPost = (id, attrs, options) => {
|
||||
@ -64,16 +65,26 @@ const forTag = (id, attrs) => {
|
||||
};
|
||||
|
||||
const forSettings = (attrs) => {
|
||||
if (attrs.cover_image) {
|
||||
attrs.cover_image = urlService.utils.urlFor('image', {image: attrs.cover_image}, true);
|
||||
}
|
||||
// @TODO: https://github.com/TryGhost/Ghost/issues/10106
|
||||
// @NOTE: Admin & Content API return a different format, need to mappers
|
||||
if (_.isArray(attrs)) {
|
||||
attrs.forEach((obj) => {
|
||||
if (['cover_image', 'logo', 'icon'].includes(obj.key) && obj.value) {
|
||||
obj.value = urlService.utils.urlFor('image', {image: obj.value}, true);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
if (attrs.cover_image) {
|
||||
attrs.cover_image = urlService.utils.urlFor('image', {image: attrs.cover_image}, true);
|
||||
}
|
||||
|
||||
if (attrs.logo) {
|
||||
attrs.logo = urlService.utils.urlFor('image', {image: attrs.logo}, true);
|
||||
}
|
||||
if (attrs.logo) {
|
||||
attrs.logo = urlService.utils.urlFor('image', {image: attrs.logo}, true);
|
||||
}
|
||||
|
||||
if (attrs.icon) {
|
||||
attrs.icon = urlService.utils.urlFor('image', {image: attrs.icon}, true);
|
||||
if (attrs.icon) {
|
||||
attrs.icon = urlService.utils.urlFor('image', {image: attrs.icon}, true);
|
||||
}
|
||||
}
|
||||
|
||||
return attrs;
|
||||
|
Loading…
Reference in New Issue
Block a user