From 4adbf87c6c5d79470d7a889eb81145a018bee8ab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bar=C4=B1=C5=9F=20Soner=20U=C5=9Fakl=C4=B1?= Date: Wed, 8 Jul 2020 21:36:48 -0400 Subject: [PATCH] feat: warn user if whitelisted tags are less than minTags --- public/language/en-GB/admin/manage/categories.json | 1 + public/src/admin/manage/category.js | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/public/language/en-GB/admin/manage/categories.json b/public/language/en-GB/admin/manage/categories.json index a8949c654b..70b282ca02 100644 --- a/public/language/en-GB/admin/manage/categories.json +++ b/public/language/en-GB/admin/manage/categories.json @@ -76,6 +76,7 @@ "alert.user-search": "Search for a user here...", "alert.find-group": "Find a Group", "alert.group-search": "Search for a group here...", + "alert.not-enough-whitelisted-tags": "Whitelisted tags are less than minimum tags, you need to create more whitelisted tags!", "collapse-all": "Collapse All", "expand-all": "Expand All", "disable-on-create": "Disable on create" diff --git a/public/src/admin/manage/category.js b/public/src/admin/manage/category.js index f4c75c38e6..497b99ca4a 100644 --- a/public/src/admin/manage/category.js +++ b/public/src/admin/manage/category.js @@ -48,6 +48,11 @@ define('admin/manage/category', [ $('[data-name="bgColor"], [data-name="color"]').each(enableColorPicker); $('#save').on('click', function () { + var tags = $('#tag-whitelist').val() ? $('#tag-whitelist').val().split(',') : []; + if (tags.length && tags.length < parseInt($('#cid-min-tags').val(), 10)) { + return app.alertError('[[admin/manage/categories:alert.not-enough-whitelisted-tags]]'); + } + if (Object.keys(modified_categories).length) { socket.emit('admin.categories.update', modified_categories, function (err, result) { if (err) {