mirror of
https://github.com/discourse/discourse.git
synced 2025-03-04 02:09:30 +00:00
UX: disable "Queue For Review" button if user can't perform action. (#13966)
Currently, it's returning JS error when trying to click the button when the action is already performed by the same staff user.
This commit is contained in:
parent
3fdb64184b
commit
8c27e69523
@ -180,6 +180,13 @@ export default Controller.extend(ModalFunctionality, {
|
|||||||
},
|
},
|
||||||
|
|
||||||
submitDisabled: not("submitEnabled"),
|
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"
|
// Staff accounts can "take action"
|
||||||
@discourseComputed("flagTopic", "selected.is_custom_flag")
|
@discourseComputed("flagTopic", "selected.is_custom_flag")
|
||||||
@ -289,12 +296,7 @@ export default Controller.extend(ModalFunctionality, {
|
|||||||
},
|
},
|
||||||
|
|
||||||
flagForReview() {
|
flagForReview() {
|
||||||
const notifyModeratorsID = 7;
|
this.set("selected", this.get("notifyModeratorsFlag"));
|
||||||
const notifyModerators = this.flagsAvailable.find(
|
|
||||||
(f) => f.id === notifyModeratorsID
|
|
||||||
);
|
|
||||||
this.set("selected", notifyModerators);
|
|
||||||
|
|
||||||
this.send("createFlag", { queue_for_review: true });
|
this.send("createFlag", { queue_for_review: true });
|
||||||
this.set("model.hidden", true);
|
this.set("model.hidden", true);
|
||||||
},
|
},
|
||||||
|
@ -44,6 +44,7 @@
|
|||||||
{{d-button
|
{{d-button
|
||||||
class="btn-danger"
|
class="btn-danger"
|
||||||
action=(action "flagForReview")
|
action=(action "flagForReview")
|
||||||
|
disabled=cantFlagForReview
|
||||||
icon="exclamation-triangle"
|
icon="exclamation-triangle"
|
||||||
label="flagging.flag_for_review"
|
label="flagging.flag_for_review"
|
||||||
}}
|
}}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user