Skip to content

A platform for community discussion. Free, open, simple.

FEATURE: In the slow mode dialog make "Enabled Until" mandatory (#12701)

Andrei Prigorshneveb99ecf1d2ac
diff --git a/app/assets/javascripts/discourse/app/controllers/edit-slow-mode.js b/app/assets/javascripts/discourse/app/controllers/edit-slow-mode.js
index 65493ed78b5..66a0a0a0382 100644
--- a/app/assets/javascripts/discourse/app/controllers/edit-slow-mode.js
+++ b/app/assets/javascripts/discourse/app/controllers/edit-slow-mode.js
@@ -5,7 +5,7 @@ import ModalFunctionality from "discourse/mixins/modal-functionality";
import Topic from "discourse/models/topic";
import { action } from "@ember/object";
import discourseComputed from "discourse-common/utils/decorators";
-import { equal } from "@ember/object/computed";
+import { equal, or } from "@ember/object/computed";
import { popupAjaxError } from "discourse/lib/ajax-error";
export default Controller.extend(ModalFunctionality, {
@@ -16,6 +16,7 @@ export default Controller.extend(ModalFunctionality, {
saveDisabled: false,
enabledUntil: null,
showCustomSelect: equal("selectedSlowMode", "custom"),
+ durationIsSet: or("hours", "minutes", "seconds"),
init() {
this._super(...arguments);
@@ -86,9 +87,9 @@ export default Controller.extend(ModalFunctionality, {
}
},
- @discourseComputed("hours", "minutes", "seconds")
- submitDisabled(hours, minutes, seconds) {
- return this.saveDisabled || !(hours || minutes || seconds);
+ @discourseComputed("saveDisabled", "durationIsSet", "enabledUntil")
+ submitDisabled(saveDisabled, durationIsSet, enabledUntil) {
+ return saveDisabled || !durationIsSet || !enabledUntil;
},
_setFromSeconds(seconds) {
diff --git a/config/locales/client.en.yml b/config/locales/client.en.yml
index cd0b16ca2c8..3b41ff765e5 100644
--- a/config/locales/client.en.yml
+++ b/config/locales/client.en.yml
@@ -2480,7 +2480,7 @@ en:
select: "Users may only post in this topic once every:"
description: "To promote thoughtful discussion in fast moving or contentious discussions, users must wait before posting again in this topic."
save: "Enable"
- enabled_until: "(Optional) Enabled until:"
+ enabled_until: "Enabled until:"
remove: "Disable"
hours: "Hours:"
minutes: "Minutes:"