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

This commit is contained in:
Andrei Prigorshnev 2021-04-15 19:16:01 +04:00 committed by GitHub
parent c54609bfcd
commit eb99ecf1d2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 5 deletions

View File

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

View File

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