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