From eb99ecf1d2ace01192151d9f56c5d7b668d2daa5 Mon Sep 17 00:00:00 2001 From: Andrei Prigorshnev Date: Thu, 15 Apr 2021 19:16:01 +0400 Subject: [PATCH] FEATURE: In the slow mode dialog make "Enabled Until" mandatory (#12701) --- .../discourse/app/controllers/edit-slow-mode.js | 9 +++++---- config/locales/client.en.yml | 2 +- 2 files changed, 6 insertions(+), 5 deletions(-) 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 65493ed78b..66a0a0a038 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 cd0b16ca2c..3b41ff765e 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:"