0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-01-06 22:40:14 -05:00

🐛 Fixed internal tags being used as primary tags (#8934)

fixes #8920

- Implements logic such that internal tags cannot be primary tags
- If the first tag on a post is an internal tag, that post will not have a primary tag
This commit is contained in:
Hannah Wolfe 2017-08-24 13:07:19 +01:00 committed by Kevin Ansfield
parent b15f09426e
commit c6d54ceea1

View file

@ -509,8 +509,12 @@ Post = ghostBookshelf.Model.extend({
} }
// If the current column settings allow it... // If the current column settings allow it...
if (!options.columns || (options.columns && options.columns.indexOf('primary_tag') > -1)) { if (!options.columns || (options.columns && options.columns.indexOf('primary_tag') > -1)) {
// ... attach a computed property of primary_tag which is the first tag or null // ... attach a computed property of primary_tag which is the first tag if it is public, else null
attrs.primary_tag = attrs.tags && attrs.tags.length > 0 ? attrs.tags[0] : null; if (attrs.tags && attrs.tags.length > 0 && attrs.tags[0].visibility === 'public') {
attrs.primary_tag = attrs.tags[0];
} else {
attrs.primary_tag = null;
}
} }
if (!options.columns || (options.columns && options.columns.indexOf('url') > -1)) { if (!options.columns || (options.columns && options.columns.indexOf('url') > -1)) {