From 10598cc10578190ca43a25d9a6edaae02e97aa58 Mon Sep 17 00:00:00 2001 From: Jasper Vriends Date: Fri, 1 Jul 2022 14:36:51 +0200 Subject: [PATCH] Fixes #143 --- .../admin/components/Modals/SelectCategoriesModal.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/js/src/admin/components/Modals/SelectCategoriesModal.js b/js/src/admin/components/Modals/SelectCategoriesModal.js index 0b3edfd..9d781de 100644 --- a/js/src/admin/components/Modals/SelectCategoriesModal.js +++ b/js/src/admin/components/Modals/SelectCategoriesModal.js @@ -102,8 +102,17 @@ export default class SelectCategoriesModal extends Modal { this.isSaving = true; + // Validate tags and prevent ghost tags (deleted tags) + let validBlogTags = []; + + this.blogCategories.map((tagId) => { + if (app.store.getById('tags', tagId)) { + validBlogTags.push(tagId); + } + }); + saveSettings({ - blog_tags: this.blogCategories.join('|'), + blog_tags: validBlogTags.join('|'), }) .then(() => { app.alerts.show(