A platform for community discussion. Free, open, simple.
UX: disable "Queue For Review" button if user can't perform action. (#13966)
Vinoth Kannan8c27e69523d2
diff --git a/app/assets/javascripts/discourse/app/controllers/flag.js b/app/assets/javascripts/discourse/app/controllers/flag.jsindex 87dbf1c8f78..7834743e08a 100644--- a/app/assets/javascripts/discourse/app/controllers/flag.js+++ b/app/assets/javascripts/discourse/app/controllers/flag.js@@ -180,6 +180,13 @@ export default Controller.extend(ModalFunctionality, {},submitDisabled: not("submitEnabled"),+ cantFlagForReview: not("notifyModeratorsFlag"),++ @discourseComputed("flagsAvailable")+ notifyModeratorsFlag(flagsAvailable) {+ const notifyModeratorsID = 7;+ return flagsAvailable.find((f) => f.id === notifyModeratorsID);+ },// Staff accounts can "take action"@discourseComputed("flagTopic", "selected.is_custom_flag")@@ -289,12 +296,7 @@ export default Controller.extend(ModalFunctionality, {},flagForReview() {- const notifyModeratorsID = 7;- const notifyModerators = this.flagsAvailable.find(- (f) => f.id === notifyModeratorsID- );- this.set("selected", notifyModerators);-+ this.set("selected", this.get("notifyModeratorsFlag"));this.send("createFlag", { queue_for_review: true });this.set("model.hidden", true);},diff --git a/app/assets/javascripts/discourse/app/templates/modal/flag.hbs b/app/assets/javascripts/discourse/app/templates/modal/flag.hbsindex 4e11f469a14..250aa5608c2 100644--- a/app/assets/javascripts/discourse/app/templates/modal/flag.hbs+++ b/app/assets/javascripts/discourse/app/templates/modal/flag.hbs@@ -44,6 +44,7 @@{{d-buttonclass="btn-danger"action=(action "flagForReview")+ disabled=cantFlagForReviewicon="exclamation-triangle"label="flagging.flag_for_review"}}