FIX: Fix broken client-side review actions (#29025)

After #28603, the options "agree and suspend" and "agree and silence" in the review queue weren't working. This was happening because the optionalService, when used as a decorator, needs a name argument to work properly. We were also lacking tests for this.
This commit is contained in:
Ted Johansson 2024-09-30 13:27:25 +08:00 committed by GitHub
parent 73f42e110a
commit e0a0a13a91
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 17 additions and 1 deletions

View File

@ -49,7 +49,7 @@ export default class ReviewableItem extends Component {
@service siteSettings;
@service currentUser;
@service composer;
@optionalService adminTools;
@optionalService("admin-tools") adminTools;
updating = null;
editing = false;

View File

@ -96,6 +96,7 @@ Fabricator(:reviewable_flagged_post) do
reviewable_by_moderator true
type "ReviewableFlaggedPost"
created_by { Fabricate(:user) }
target_created_by { Fabricate(:user) }
topic
target_type "Post"
target { Fabricate(:post) }

View File

@ -54,6 +54,21 @@ describe "Reviewables", type: :system do
expect(composer).to be_opened
expect(composer.composer_input.value).to eq(post.raw)
end
it "should open a modal when suspending a user" do
visit("/review")
select_kit =
PageObjects::Components::SelectKit.new(".dropdown-select-box.post-agree-and-hide")
select_kit.expand
select_kit.select_row_by_value("post-agree_and_suspend")
expect(review_page).to have_css(
"#discourse-modal-title",
text: I18n.t("js.flagging.take_action_options.suspend.title"),
)
end
end
end