A platform for community discussion. Free, open, simple.
UX: Show "Approve this post?" heading on rejected queued posts (#39767)
Kriscdfab46a0653
diff --git a/frontend/discourse/app/components/reviewable/item.gjs b/frontend/discourse/app/components/reviewable/item.gjsindex 67b1867edc4..6d2555ec184 100644--- a/frontend/discourse/app/components/reviewable/item.gjs+++ b/frontend/discourse/app/components/reviewable/item.gjs@@ -870,14 +870,10 @@ export default class ReviewableItem extends Component {<h3 class="review-item__aside-title">{{#if this.editing}}{{i18n "review.editing_post"}}- {{else if (eq this.reviewable.status PENDING)}}- {{#if this.displayContextQuestion}}- {{this.reviewable.flaggedReviewableContextQuestion}}- {{else if this.reviewable.userReviewableContextQuestion}}- {{this.reviewable.userReviewableContextQuestion}}- {{else}}- {{i18n "review.moderator_actions"}}- {{/if}}+ {{else if this.displayContextQuestion}}+ {{this.reviewable.flaggedReviewableContextQuestion}}+ {{else if this.reviewable.userReviewableContextQuestion}}+ {{this.reviewable.userReviewableContextQuestion}}{{else}}{{i18n "review.moderator_actions"}}{{/if}}diff --git a/frontend/discourse/app/models/reviewable.js b/frontend/discourse/app/models/reviewable.jsindex 8f09cd1bdd6..5bb6baf3766 100644--- a/frontend/discourse/app/models/reviewable.js+++ b/frontend/discourse/app/models/reviewable.js@@ -79,9 +79,13 @@ export default class Reviewable extends RestModel {});}- @computed("resolvedType", "reviewable_scores")+ @computed("resolvedType", "reviewable_scores", "status")get userReviewableContextQuestion() {if (this.resolvedType === "ReviewableUser") {+ // in this case the only remaining action is "scrub record" so the question shouldn't show+ if (this.status !== PENDING) {+ return null;+ }const isSuspectUser = this.reviewable_scores?.some((score) => score.reason_type === "suspect_user");diff --git a/spec/system/page_objects/pages/review.rb b/spec/system/page_objects/pages/review.rbindex 51e6f7e96d2..93418367138 100644--- a/spec/system/page_objects/pages/review.rb+++ b/spec/system/page_objects/pages/review.rb@@ -152,6 +152,12 @@ module PageObjectsendend+ def has_no_context_question?(reviewable, text)+ within(reviewable_by_id(reviewable.id)) do+ page.has_no_css?(".review-item__aside-title", text: text)+ end+ end+def flag_reason_componentPageObjects::Components::Review::FlagReason.newenddiff --git a/spec/system/viewing_reviewable_spec.rb b/spec/system/viewing_reviewable_spec.rbindex fcb544a197e..6d7e1319835 100644--- a/spec/system/viewing_reviewable_spec.rb+++ b/spec/system/viewing_reviewable_spec.rb@@ -319,8 +319,11 @@ describe "Viewing reviewable item" doendit "shows context question for rejected queued post" do+ reviewable_queued_post.update!(status: Reviewable.statuses[:rejected])+review_page.visit_reviewable(reviewable_queued_post)+ expect(review_page).to have_reviewable_with_rejected_status(reviewable_queued_post)expect(review_page).to have_context_question(reviewable_queued_post,I18n.t("js.review.context_question.approve_post"),@@ -356,6 +359,11 @@ describe "Viewing reviewable item" doexpect(page).to have_text(user.name)+ expect(review_page).to have_no_context_question(+ reviewable,+ I18n.t("js.review.context_question.approve_user"),+ )+review_page.click_scrub_user_buttonscrubbing_reason = "a spammer who knows how to make GDPR requests"