UX: show error message instead of disabling save button on tag groups page (#12767)

UX: show error message instead of disabling save button on tag groups page (#12767)

Unable to rename Tag Group's title ("Save" button stays grayed-out) - bug - Discourse Meta

diff --git a/app/assets/javascripts/discourse/app/components/tag-groups-form.js b/app/assets/javascripts/discourse/app/components/tag-groups-form.js
index d701fb3..8bf218f 100644
--- a/app/assets/javascripts/discourse/app/components/tag-groups-form.js
+++ b/app/assets/javascripts/discourse/app/components/tag-groups-form.js
@@ -23,14 +23,12 @@ export default Component.extend(bufferedProperty("model"), {
   },
 
   @discourseComputed(
-    "buffered.isSaving",
     "buffered.name",
     "buffered.tag_names",
     "buffered.permissions"
   )
-  savingDisabled(isSaving, name, tagNames, permissions) {
+  cannotSave(name, tagNames, permissions) {
     return (
-      isSaving ||
       isEmpty(name) ||
       isEmpty(tagNames) ||
       (!this.everyoneSelected(permissions) &&
@@ -116,6 +114,11 @@ export default Component.extend(bufferedProperty("model"), {
     },
 
     save() {
+      if (this.cannotSave) {
+        bootbox.alert(I18n.t("tagging.groups.cannot_save"));
+        return false;
+      }
+
       const attrs = this.buffered.getProperties(
         "name",
         "tag_names",
diff --git a/app/assets/javascripts/discourse/app/templates/components/tag-groups-form.hbs b/app/assets/javascripts/discourse/app/templates/components/tag-groups-form.hbs
index 76545e5..2291f06 100644
--- a/app/assets/javascripts/discourse/app/templates/components/tag-groups-form.hbs
+++ b/app/assets/javascripts/discourse/app/templates/components/tag-groups-form.hbs
@@ -93,7 +93,7 @@
     {{d-button
       class="btn-default"
       action=(action "save")
-      disabled=savingDisabled
+      disabled=buffered.isSaving
       label="tagging.groups.save"}}
 
     {{d-button
diff --git a/app/assets/javascripts/discourse/tests/acceptance/tag-groups-test.js b/app/assets/javascripts/discourse/tests/acceptance/tag-groups-test.js
index 3ec8ac8..27c3093 100644
--- a/app/assets/javascripts/discourse/tests/acceptance/tag-groups-test.js
+++ b/app/assets/javascripts/discourse/tests/acceptance/tag-groups-test.js
@@ -66,8 +66,6 @@ acceptance("Tag Groups", function (needs) {
     await tags.selectRowByValue("monkey");
 
     await click("#visible-permission");
-    assert.ok(queryAll(".tag-group-content .btn.btn-default:disabled").length);
-
     await groups.expand();
     await groups.selectRowByIndex(1);
     await groups.selectRowByIndex(0);
diff --git a/config/locales/client.en.yml b/config/locales/client.en.yml
index 66a61de..e1a0301 100644
--- a/config/locales/client.en.yml
+++ b/config/locales/client.en.yml
@@ -3677,6 +3677,7 @@ en:
         everyone_can_use: "Tags can be used by everyone"
         usable_only_by_groups: "Tags are visible to everyone, but only the following groups can use them"
         visible_only_to_groups: "Tags are visible only to the following groups"
+        cannot_save: "Cannot save tag group. Make sure that there is at least one tag present, tag group name is not empty, and a group is selected for tags permission."
 
       topics:
         none:

GitHub sha: e54b5dad

This commit appears in #12767 which was approved by eviltrout. It was merged by techAPJ.

This commit has been mentioned on Discourse Meta. There might be relevant details there: