Skip to content

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

FIX: Fix broken notifyModeratorsFlag (#41989)

Bannon Tanner5d09b8aef337
diff --git a/frontend/discourse/app/components/modal/flag.gjs b/frontend/discourse/app/components/modal/flag.gjs
index 2b6d9c62a1e..42fbde5beab 100644
--- a/frontend/discourse/app/components/modal/flag.gjs
+++ b/frontend/discourse/app/components/modal/flag.gjs
@@ -17,8 +17,6 @@ import DButton from "discourse/ui-kit/d-button";
import DModal from "discourse/ui-kit/d-modal";
import { i18n } from "discourse-i18n";
-const NOTIFY_MODERATORS_KEY = "notify_moderators";
-
export default class Flag extends Component {
@service adminTools;
@service currentUser;
@@ -127,10 +125,6 @@ export default class Flag extends Component {
);
}
- get notifyModeratorsFlag() {
- return this.flagsAvailable.find((f) => f.id === NOTIFY_MODERATORS_KEY);
- }
-
get canTakeAction() {
return (
!this.args.model.flagTarget.targetsTopic() &&
@@ -217,7 +211,6 @@ export default class Flag extends Component {
@action
flagForReview() {
- this.selected ||= this.notifyModeratorsFlag;
this.createFlag({ queue_for_review: true });
this.args.model.setHidden();
}
@@ -297,7 +290,7 @@ export default class Flag extends Component {
<DButton
class="btn-danger flag-modal__flag-for-review"
@action={{this.flagForReview}}
- @disabled={{not this.submitEnabled this.notifyModeratorsFlag}}
+ @disabled={{not this.submitEnabled}}
@icon="triangle-exclamation"
@label="flagging.flag_for_review"
/>
diff --git a/frontend/discourse/tests/acceptance/flag-post-test.js b/frontend/discourse/tests/acceptance/flag-post-test.js
index 448aebb0878..31fdac2a0e6 100644
--- a/frontend/discourse/tests/acceptance/flag-post-test.js
+++ b/frontend/discourse/tests/acceptance/flag-post-test.js
@@ -155,6 +155,21 @@ acceptance(`flagging`, function (needs) {
);
});
+ test("Flag for Review requires a selected reason", async function (assert) {
+ await visit("/t/internationalization-localization/280");
+ await openFlagModal();
+
+ assert
+ .dom(".flag-modal__flag-for-review")
+ .isDisabled("stays disabled until a reason is selected");
+
+ await click("#radio_inappropriate");
+
+ assert
+ .dom(".flag-modal__flag-for-review")
+ .isNotDisabled("enables once a non-require_message reason is selected");
+ });
+
test("Can delete spammer from spam", async function (assert) {
await visit("/t/internationalization-localization/280");
await openFlagModal();