A platform for community discussion. Free, open, simple.
FIX: Ensure client-side reviewable claiming data is set correctly (#33405)
Gary Pendergastb47b167b4062
diff --git a/app/assets/javascripts/discourse/app/components/reviewable-claimed-topic.gjs b/app/assets/javascripts/discourse/app/components/reviewable-claimed-topic.gjsindex 35f0f58301f..9d0a62ebb30 100644--- a/app/assets/javascripts/discourse/app/components/reviewable-claimed-topic.gjs+++ b/app/assets/javascripts/discourse/app/components/reviewable-claimed-topic.gjs@@ -33,7 +33,10 @@ export default class ReviewableClaimedTopic extends Component {try {await claim.save({ topic_id: this.args.topicId });- this.args.onClaim(this.currentUser);+ this.args.onClaim({+ user: this.currentUser,+ automatic: false,+ });} catch (e) {popupAjaxError(e);}diff --git a/spec/system/page_objects/pages/review.rb b/spec/system/page_objects/pages/review.rbindex 58259cb5fd2..9d7bb798f02 100644--- a/spec/system/page_objects/pages/review.rb+++ b/spec/system/page_objects/pages/review.rb@@ -138,6 +138,14 @@ module PageObjects)end+ def click_claim_reviewable+ find(".reviewable-claimed-topic .claim").click+ end++ def click_unclaim_reviewable+ find(".reviewable-claimed-topic .unclaim").click+ end+privatedef reviewable_action_dropdowndiff --git a/spec/system/reviewables_spec.rb b/spec/system/reviewables_spec.rbindex e47f3d5014f..d88677410e8 100644--- a/spec/system/reviewables_spec.rb+++ b/spec/system/reviewables_spec.rb@@ -282,6 +282,24 @@ describe "Reviewables", type: :system doexpect(review_page).to have_reviewable_with_rejected_status(queued_post_reviewable)end++ context "with reviewable claiming enabled" do+ before { SiteSetting.reviewable_claiming = "required" }++ it "properly claims and unclaims the reviewable" do+ review_page.visit_reviewable(queued_post_reviewable)++ expect(review_page).to have_no_reviewable_action_dropdown++ review_page.click_claim_reviewable++ expect(review_page).to have_reviewable_action_dropdown++ review_page.click_unclaim_reviewable++ expect(review_page).to have_no_reviewable_action_dropdown+ end+ endendend