From b5987a6979ef6ecf94afa18f3f5da9dc1ac920f4 Mon Sep 17 00:00:00 2001 From: Kevin Ansfield Date: Tue, 29 Aug 2017 04:19:47 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20Fix=20#tags=20added=20via=20PSM?= =?UTF-8?q?=20having=20"public"=20visibility=20(#841)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit refs TryGhost/Ghost#8943 - Tag model has an observer watching the `isNew` and `name` properties so that it can set the `visibility: "internal"` property for new tags based on their name starting with a `#` - PSM creates tags using `store.createRecord('tag', {name: tagName})` which means that the tag is instantiated with the `isNew` and `name` properties already set (unlike the tags screen where an empty tag is first created before the name is set via UI) - because the properties are there before at instantiation the observer never fires because it's only watching for changes - adds the `.on('init')` modifier to the `setVisibilityOnNew` observer so that it's run for the watched properties during instantiation as well as on change --- ghost/admin/app/models/tag.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ghost/admin/app/models/tag.js b/ghost/admin/app/models/tag.js index 0e300ed81a..bcc4360c3b 100644 --- a/ghost/admin/app/models/tag.js +++ b/ghost/admin/app/models/tag.js @@ -53,5 +53,5 @@ export default Model.extend(ValidationEngine, { if (this.get('isNew') && !this.get('isSaving')) { this.setVisibility(); } - }) + }).on('init') });