From c6d54ceea1a7c79f98bf2b0d643e7b774912b6f1 Mon Sep 17 00:00:00 2001 From: Hannah Wolfe Date: Thu, 24 Aug 2017 13:07:19 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20Fixed=20internal=20tags=20being?= =?UTF-8?q?=20used=20as=20primary=20tags=20(#8934)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- core/server/models/post.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/core/server/models/post.js b/core/server/models/post.js index 2a8922e07d..fb19e7ed75 100644 --- a/core/server/models/post.js +++ b/core/server/models/post.js @@ -509,8 +509,12 @@ Post = ghostBookshelf.Model.extend({ } // If the current column settings allow it... 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 - attrs.primary_tag = attrs.tags && attrs.tags.length > 0 ? attrs.tags[0] : null; + // ... attach a computed property of primary_tag which is the first tag if it is public, else 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)) {