Skip to content
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.

Commit

Permalink
Add v3.24.0
Browse files Browse the repository at this point in the history
  • Loading branch information
YannickRe committed Jul 10, 2020
1 parent 10d1f68 commit 8a8efe8
Show file tree
Hide file tree
Showing 23 changed files with 183 additions and 38 deletions.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

5 changes: 5 additions & 0 deletions core/frontend/helpers/ghost_foot.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ module.exports = function ghost_foot(options) { // eslint-disable-line camelcase

const globalCodeinjection = settingsCache.get('codeinjection_foot');
const postCodeinjection = options.data.root && options.data.root.post ? options.data.root.post.codeinjection_foot : null;
const tagCodeinjection = options.data.root && options.data.root.tag ? options.data.root.tag.codeinjection_foot : null;

if (!_.isEmpty(globalCodeinjection)) {
foot.push(globalCodeinjection);
Expand All @@ -20,5 +21,9 @@ module.exports = function ghost_foot(options) { // eslint-disable-line camelcase
foot.push(postCodeinjection);
}

if (!_.isEmpty(tagCodeinjection)) {
foot.push(tagCodeinjection);
}

return new SafeString(foot.join(' ').trim());
};
5 changes: 5 additions & 0 deletions core/frontend/helpers/ghost_head.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ module.exports = function ghost_head(options) { // eslint-disable-line camelcase
const context = dataRoot._locals.context ? dataRoot._locals.context : null;
const safeVersion = dataRoot._locals.safeVersion;
const postCodeInjection = dataRoot && dataRoot.post ? dataRoot.post.codeinjection_head : null;
const tagCodeInjection = dataRoot && dataRoot.tag ? dataRoot.tag.codeinjection_head : null;
const globalCodeinjection = settingsCache.get('codeinjection_head');
const useStructuredData = !config.isPrivacyDisabled('useStructuredData');
const referrerPolicy = config.get('referrerPolicy') ? config.get('referrerPolicy') : 'no-referrer-when-downgrade';
Expand Down Expand Up @@ -189,6 +190,10 @@ module.exports = function ghost_head(options) { // eslint-disable-line camelcase
if (!_.isEmpty(postCodeInjection)) {
head.push(postCodeInjection);
}

if (!_.isEmpty(tagCodeInjection)) {
head.push(tagCodeInjection);
}
}
debug('end');
return new SafeString(head.join('\n ').trim());
Expand Down
4 changes: 4 additions & 0 deletions core/frontend/meta/canonical_url.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ function getCanonicalUrl(data) {
return data.post.canonical_url;
}

if (_.includes(data.context, 'tag') && data.tag && data.tag.canonical_url) {
return data.tag.canonical_url;
}

let url = urlUtils.urlJoin(urlUtils.urlFor('home', true), getUrl(data, false));

if (url.indexOf('/amp/')) {
Expand Down
3 changes: 2 additions & 1 deletion core/frontend/meta/description.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ function getDescription(data, root, options = {}) {
if (!options.property && _.includes(context, 'paged')) {
description = '';
} else {
description = data.tag.meta_description
description = data.tag[`${options.property}_description`]
|| data.tag.meta_description
|| data.tag.description
|| (options.property ? settingsCache.get('meta_description') : '')
|| '';
Expand Down
4 changes: 3 additions & 1 deletion core/frontend/meta/og_image.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@ function getOgImage(data) {
}

if (_.includes(context, 'tag')) {
if (contextObject.feature_image) {
if (contextObject.og_image) {
return urlUtils.relativeToAbsolute(contextObject.og_image);
} else if (contextObject.feature_image) {
return urlUtils.relativeToAbsolute(contextObject.feature_image);
} else if (settingsCache.get('cover_image')) {
return urlUtils.relativeToAbsolute(settingsCache.get('cover_image'));
Expand Down
2 changes: 1 addition & 1 deletion core/frontend/meta/title.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ function getTitle(data, root, options = {}) {
title = data.tag.meta_title || data.tag.name + ' - ' + siteTitle + pageString;
// Tag title, index
} else if (_.includes(context, 'tag') && data.tag) {
title = data.tag.meta_title || data.tag.name + ' - ' + siteTitle;
title = data.tag[optionsPropertyName] || data.tag.meta_title || data.tag.name + ' - ' + siteTitle;
// Post title
} else if (_.includes(context, 'post') && data.post) {
title = data.post[optionsPropertyName] || data.post.meta_title || data.post.title;
Expand Down
4 changes: 3 additions & 1 deletion core/frontend/meta/twitter_image.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@ function getTwitterImage(data) {
}

if (_.includes(context, 'tag')) {
if (contextObject.feature_image) {
if (contextObject.twitter_image) {
return urlUtils.relativeToAbsolute(contextObject.twitter_image);
} else if (contextObject.feature_image) {
return urlUtils.relativeToAbsolute(contextObject.feature_image);
} else if (settingsCache.get('cover_image')) {
return urlUtils.relativeToAbsolute(settingsCache.get('cover_image'));
Expand Down
7 changes: 6 additions & 1 deletion core/server/api/canary/utils/serializers/input/authors.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
const debug = require('ghost-ignition').debug('api:canary:utils:serializers:input:authors');
const slugFilterOrder = require('./utils/slug-filter-order');
const utils = require('../../index');

function setDefaultOrder(frame) {
if (!frame.options.order) {
if (!frame.options.order && frame.options.filter) {
frame.options.autoOrder = slugFilterOrder('users', frame.options.filter);
}

if (!frame.options.order && !frame.options.autoOrder) {
frame.options.order = 'name asc';
}
}
Expand Down
4 changes: 4 additions & 0 deletions core/server/api/canary/utils/serializers/input/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ module.exports = {
return require('./users');
},

get authors() {
return require('./authors');
},

get tags() {
return require('./tags');
},
Expand Down
7 changes: 6 additions & 1 deletion core/server/api/canary/utils/serializers/input/pages.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ const debug = require('ghost-ignition').debug('api:canary:utils:serializers:inpu
const mapNQLKeyValues = require('@nexes/nql').utils.mapKeyValues;
const mobiledoc = require('../../../../../lib/mobiledoc');
const url = require('./utils/url');
const slugFilterOrder = require('./utils/slug-filter-order');
const localUtils = require('../../index');
const postsMetaSchema = require('../../../../../data/schema').tables.posts_meta;

Expand Down Expand Up @@ -48,7 +49,11 @@ function setDefaultOrder(frame) {
includesOrderedRelations = _.intersection(orderedRelations, frame.options.withRelated).length > 0;
}

if (!frame.options.order && !includesOrderedRelations) {
if (!frame.options.order && !includesOrderedRelations && frame.options.filter) {
frame.options.autoOrder = slugFilterOrder('posts', frame.options.filter);
}

if (!frame.options.order && !frame.options.autoOrder && !includesOrderedRelations) {
frame.options.order = 'title asc';
}
}
Expand Down
7 changes: 6 additions & 1 deletion core/server/api/canary/utils/serializers/input/posts.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ const _ = require('lodash');
const debug = require('ghost-ignition').debug('api:canary:utils:serializers:input:posts');
const mapNQLKeyValues = require('@nexes/nql').utils.mapKeyValues;
const url = require('./utils/url');
const slugFilterOrder = require('./utils/slug-filter-order');
const localUtils = require('../../index');
const mobiledoc = require('../../../../../lib/mobiledoc');
const postsMetaSchema = require('../../../../../data/schema').tables.posts_meta;
Expand Down Expand Up @@ -48,7 +49,11 @@ function setDefaultOrder(frame) {
includesOrderedRelations = _.intersection(orderedRelations, frame.options.withRelated).length > 0;
}

if (!frame.options.order && !includesOrderedRelations) {
if (!frame.options.order && !includesOrderedRelations && frame.options.filter) {
frame.options.autoOrder = slugFilterOrder('posts', frame.options.filter);
}

if (!frame.options.order && !frame.options.autoOrder && !includesOrderedRelations) {
frame.options.order = 'published_at desc';
}
}
Expand Down
11 changes: 9 additions & 2 deletions core/server/api/canary/utils/serializers/input/tags.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,17 @@
const debug = require('ghost-ignition').debug('api:canary:utils:serializers:input:tags');
const url = require('./utils/url');
const slugFilterOrder = require('./utils/slug-filter-order');
const utils = require('../../index');

function setDefaultOrder(frame) {
if (!frame.options.order) {
frame.options.order = 'name asc';
let defaultOrder = 'name asc';

if (!frame.options.order && frame.options.filter) {
frame.options.autoOrder = slugFilterOrder('tags', frame.options.filter);
}

if (!frame.options.order && !frame.options.autoOrder) {
frame.options.order = defaultOrder;
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
const slugFilterOrder = (table, filter) => {
let orderMatch = filter.match(/slug:\s?\[(.*)\]/);

if (orderMatch) {
let orderSlugs = orderMatch[1].split(',');
let order = 'CASE ';

orderSlugs.forEach((slug, index) => {
order += `WHEN \`${table}\`.\`slug\` = '${slug}' THEN ${index} `;
});

order += 'END ASC';

return order;
}
};

module.exports = slugFilterOrder;
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
const logging = require('../../../../../shared/logging');

// new setting keys and group mapping
const groupMapping = [{
group: 'portal',
keys: [
'portal_button_style',
'portal_button_icon',
'portal_button_signup_text'
]
}];

module.exports = {
config: {
transaction: true
},

async up(options) {
// set the correct group value for new settings
await Promise.map(groupMapping, async (groupMap) => {
return await Promise.map(groupMap.keys, async (key) => {
logging.info(`Updating setting ${key} to group ${groupMap.group}`);

return await options
.transacting('settings')
.where('key', key)
.update({
group: groupMap.group
});
});
});
},

// `up` is only run to update correct group value for each setting instead of default.
// it doesn't make sense to be revert a setting's group to default `core` again
async down() {}
};
4 changes: 3 additions & 1 deletion core/server/models/base/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -696,7 +696,7 @@ ghostBookshelf.Model = ghostBookshelf.Model.extend({
case 'findAll':
return baseOptions.concat(extraOptions, ['filter', 'columns', 'mongoTransformer']);
case 'findPage':
return baseOptions.concat(extraOptions, ['filter', 'order', 'page', 'limit', 'columns', 'mongoTransformer']);
return baseOptions.concat(extraOptions, ['filter', 'order', 'autoOrder', 'page', 'limit', 'columns', 'mongoTransformer']);
default:
return baseOptions.concat(extraOptions);
}
Expand Down Expand Up @@ -907,6 +907,8 @@ ghostBookshelf.Model = ghostBookshelf.Model.extend({

if (options.order) {
options.order = this.parseOrderOption(options.order, options.withRelated);
} else if (options.autoOrder) {
options.orderRaw = options.autoOrder;
} else if (this.orderDefaultRaw) {
options.orderRaw = this.orderDefaultRaw(options);
} else if (this.orderDefaultOptions) {
Expand Down
2 changes: 1 addition & 1 deletion core/server/translations/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,7 @@
"members": {
"memberNotFound": "Member not found.",
"memberAlreadyExists": {
"message": "Duplicate email address",
"message": "Member already exists",
"context": "Attempting to add member with existing email address."
},
"stripeNotConnected": {
Expand Down
6 changes: 3 additions & 3 deletions core/server/web/admin/views/default-prod.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<title>Ghost Admin</title>


<meta name="ghost-admin/config/environment" content="%7B%22modulePrefix%22%3A%22ghost-admin%22%2C%22environment%22%3A%22production%22%2C%22rootURL%22%3A%22%2F%22%2C%22locationType%22%3A%22trailing-hash%22%2C%22EmberENV%22%3A%7B%22FEATURES%22%3A%7B%7D%2C%22EXTEND_PROTOTYPES%22%3A%7B%22Date%22%3Afalse%2C%22Array%22%3Atrue%2C%22String%22%3Atrue%2C%22Function%22%3Afalse%7D%2C%22_APPLICATION_TEMPLATE_WRAPPER%22%3Afalse%2C%22_JQUERY_INTEGRATION%22%3Atrue%2C%22_TEMPLATE_ONLY_GLIMMER_COMPONENTS%22%3Atrue%7D%2C%22APP%22%3A%7B%22version%22%3A%223.23%22%2C%22name%22%3A%22ghost-admin%22%7D%2C%22ember-simple-auth%22%3A%7B%7D%2C%22moment%22%3A%7B%22includeTimezone%22%3A%22all%22%7D%2C%22ember-cli-mirage%22%3A%7B%22usingProxy%22%3Afalse%2C%22useDefaultPassthroughs%22%3Atrue%7D%2C%22exportApplicationGlobal%22%3Afalse%2C%22ember-load%22%3A%7B%22loadingIndicatorClass%22%3A%22ember-load-indicator%22%7D%7D" />
<meta name="ghost-admin/config/environment" content="%7B%22modulePrefix%22%3A%22ghost-admin%22%2C%22environment%22%3A%22production%22%2C%22rootURL%22%3A%22%2F%22%2C%22locationType%22%3A%22trailing-hash%22%2C%22EmberENV%22%3A%7B%22FEATURES%22%3A%7B%7D%2C%22EXTEND_PROTOTYPES%22%3A%7B%22Date%22%3Afalse%2C%22Array%22%3Atrue%2C%22String%22%3Atrue%2C%22Function%22%3Afalse%7D%2C%22_APPLICATION_TEMPLATE_WRAPPER%22%3Afalse%2C%22_JQUERY_INTEGRATION%22%3Atrue%2C%22_TEMPLATE_ONLY_GLIMMER_COMPONENTS%22%3Atrue%7D%2C%22APP%22%3A%7B%22version%22%3A%223.24%22%2C%22name%22%3A%22ghost-admin%22%7D%2C%22ember-simple-auth%22%3A%7B%7D%2C%22moment%22%3A%7B%22includeTimezone%22%3A%22all%22%7D%2C%22ember-cli-mirage%22%3A%7B%22usingProxy%22%3Afalse%2C%22useDefaultPassthroughs%22%3Atrue%7D%2C%22exportApplicationGlobal%22%3Afalse%2C%22ember-load%22%3A%7B%22loadingIndicatorClass%22%3A%22ember-load-indicator%22%7D%7D" />

<meta name="HandheldFriendly" content="True" />
<meta name="MobileOptimized" content="320" />
Expand All @@ -34,7 +34,7 @@


<link rel="stylesheet" href="assets/vendor.min-59d06862d7441e413f92fcc5c41f807e.css">
<link rel="stylesheet" href="assets/ghost.min-8fa2ddf6038e7c0ed9f7f840f8440501.css" title="light">
<link rel="stylesheet" href="assets/ghost.min-4053bee034b1d887e768cdc3ed2e9cbb.css" title="light">



Expand All @@ -53,7 +53,7 @@


<script src="assets/vendor.min-8588d6e951f88d5f76ef7dcf04aa957a.js"></script>
<script src="assets/ghost.min-270bf551c4b4650fffe44d49ef7e2ed8.js"></script>
<script src="assets/ghost.min-231fdf5b6b261a6bf2e1569b829a83d9.js"></script>

</body>
</html>
6 changes: 3 additions & 3 deletions core/server/web/admin/views/default.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<title>Ghost Admin</title>


<meta name="ghost-admin/config/environment" content="%7B%22modulePrefix%22%3A%22ghost-admin%22%2C%22environment%22%3A%22production%22%2C%22rootURL%22%3A%22%2F%22%2C%22locationType%22%3A%22trailing-hash%22%2C%22EmberENV%22%3A%7B%22FEATURES%22%3A%7B%7D%2C%22EXTEND_PROTOTYPES%22%3A%7B%22Date%22%3Afalse%2C%22Array%22%3Atrue%2C%22String%22%3Atrue%2C%22Function%22%3Afalse%7D%2C%22_APPLICATION_TEMPLATE_WRAPPER%22%3Afalse%2C%22_JQUERY_INTEGRATION%22%3Atrue%2C%22_TEMPLATE_ONLY_GLIMMER_COMPONENTS%22%3Atrue%7D%2C%22APP%22%3A%7B%22version%22%3A%223.23%22%2C%22name%22%3A%22ghost-admin%22%7D%2C%22ember-simple-auth%22%3A%7B%7D%2C%22moment%22%3A%7B%22includeTimezone%22%3A%22all%22%7D%2C%22ember-cli-mirage%22%3A%7B%22usingProxy%22%3Afalse%2C%22useDefaultPassthroughs%22%3Atrue%7D%2C%22exportApplicationGlobal%22%3Afalse%2C%22ember-load%22%3A%7B%22loadingIndicatorClass%22%3A%22ember-load-indicator%22%7D%7D" />
<meta name="ghost-admin/config/environment" content="%7B%22modulePrefix%22%3A%22ghost-admin%22%2C%22environment%22%3A%22production%22%2C%22rootURL%22%3A%22%2F%22%2C%22locationType%22%3A%22trailing-hash%22%2C%22EmberENV%22%3A%7B%22FEATURES%22%3A%7B%7D%2C%22EXTEND_PROTOTYPES%22%3A%7B%22Date%22%3Afalse%2C%22Array%22%3Atrue%2C%22String%22%3Atrue%2C%22Function%22%3Afalse%7D%2C%22_APPLICATION_TEMPLATE_WRAPPER%22%3Afalse%2C%22_JQUERY_INTEGRATION%22%3Atrue%2C%22_TEMPLATE_ONLY_GLIMMER_COMPONENTS%22%3Atrue%7D%2C%22APP%22%3A%7B%22version%22%3A%223.24%22%2C%22name%22%3A%22ghost-admin%22%7D%2C%22ember-simple-auth%22%3A%7B%7D%2C%22moment%22%3A%7B%22includeTimezone%22%3A%22all%22%7D%2C%22ember-cli-mirage%22%3A%7B%22usingProxy%22%3Afalse%2C%22useDefaultPassthroughs%22%3Atrue%7D%2C%22exportApplicationGlobal%22%3Afalse%2C%22ember-load%22%3A%7B%22loadingIndicatorClass%22%3A%22ember-load-indicator%22%7D%7D" />

<meta name="HandheldFriendly" content="True" />
<meta name="MobileOptimized" content="320" />
Expand All @@ -34,7 +34,7 @@


<link rel="stylesheet" href="assets/vendor.min-59d06862d7441e413f92fcc5c41f807e.css">
<link rel="stylesheet" href="assets/ghost.min-8fa2ddf6038e7c0ed9f7f840f8440501.css" title="light">
<link rel="stylesheet" href="assets/ghost.min-4053bee034b1d887e768cdc3ed2e9cbb.css" title="light">



Expand All @@ -53,7 +53,7 @@


<script src="assets/vendor.min-8588d6e951f88d5f76ef7dcf04aa957a.js"></script>
<script src="assets/ghost.min-270bf551c4b4650fffe44d49ef7e2ed8.js"></script>
<script src="assets/ghost.min-231fdf5b6b261a6bf2e1569b829a83d9.js"></script>

</body>
</html>
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ghost",
"version": "3.23.1",
"version": "3.24.0",
"description": "The professional publishing platform",
"author": "Ghost Foundation",
"homepage": "https://ghost.org",
Expand Down Expand Up @@ -99,7 +99,7 @@
"jsonwebtoken": "8.5.1",
"juice": "6.0.0",
"keypair": "1.0.1",
"knex": "0.21.1",
"knex": "0.21.2",
"knex-migrator": "3.4.6",
"lodash": "4.17.19",
"mailgun-js": "0.22.0",
Expand Down
Loading

0 comments on commit 8a8efe8

Please sign in to comment.