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

https://meta.discourse.org/t/unable-to-rename-tag-groups-title-save-button-stays-grayed-out/172293/
This commit is contained in:
Arpit Jalan 2021-04-20 21:40:02 +05:30 committed by GitHub
parent 48d04e934d
commit e54b5dadab
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 8 additions and 6 deletions

View File

@ -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",

View File

@ -93,7 +93,7 @@
{{d-button
class="btn-default"
action=(action "save")
disabled=savingDisabled
disabled=buffered.isSaving
label="tagging.groups.save"}}
{{d-button

View File

@ -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);

View File

@ -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: