A platform for community discussion. Free, open, simple.
UX: enable refreshed review page (#36711)
Krzysztof Kotlarek5e46fd35f9ac
diff --git a/config/site_settings.yml b/config/site_settings.ymlindex b016498e8ec..59f46861029 100644--- a/config/site_settings.yml+++ b/config/site_settings.yml@@ -4190,6 +4190,7 @@ experimental:type: group_listdefault: ""area: "experimental"+ hidden: truereviewable_old_moderator_actions:default: truehidden: truediff --git a/lib/guardian.rb b/lib/guardian.rbindex 2e602ea8cc4..c4c354ec53c 100644--- a/lib/guardian.rb+++ b/lib/guardian.rb@@ -610,7 +610,7 @@ class Guardianenddef can_see_reviewable_ui_refresh?- @user.in_any_groups?(SiteSetting.reviewable_ui_refresh_map)+ trueenddef is_me?(other)diff --git a/plugins/chat/spec/system/reviewables_spec.rb b/plugins/chat/spec/system/reviewables_spec.rbindex c1e75656bef..5a658a339dc 100644--- a/plugins/chat/spec/system/reviewables_spec.rb+++ b/plugins/chat/spec/system/reviewables_spec.rb@@ -31,13 +31,13 @@ describe "Reviewables", type: :system doit "does not throw an error" dovisit("/review?type=Chat%3A%3AReviewableMessage")- expect(page).to have_selector(".reviewable-item.reviewable-chat-message")+ expect(page).to have_selector(".review-item__post-content")endit "adds the option to ignore the flag" dovisit("/review?type=Chat%3A%3AReviewableMessage")- expect(page).to have_selector(".reviewable-actions .chat-message-ignore")+ expect(page).to have_text(I18n.t("chat.reviewables.actions.ignore.title"))endendenddiff --git a/spec/system/flagging_post_spec.rb b/spec/system/flagging_post_spec.rbindex 52cee8e861f..a8f23888d9b 100644--- a/spec/system/flagging_post_spec.rb+++ b/spec/system/flagging_post_spec.rb@@ -10,6 +10,7 @@ describe "Flagging post", type: :system dolet(:topic_page) { PageObjects::Pages::Topic.new }let(:flag_modal) { PageObjects::Modals::Flag.new }let(:silence_user_modal) { PageObjects::Modals::PenalizeUser.new("silence") }+ let(:refreshed_review_page) { PageObjects::Pages::RefreshedReview.new }describe "Using Take Action" dobefore { sign_in(current_user) }@@ -31,8 +32,7 @@ describe "Flagging post", type: :system dovisit "/review/#{other_flag_reviewable.id}"- expect(page).to have_content(I18n.t("js.review.statuses.approved_flag.title"))- expect(page).to have_css(".reviewable-meta-data .status .approved")+ expect(refreshed_review_page).to have_reviewable_with_approved_status(other_flag_reviewable)endit "can choose to immediately silence the user" do@@ -56,8 +56,7 @@ describe "Flagging post", type: :system dovisit "/review/#{Reviewable.sole.id}"- expect(page).to have_content(I18n.t("js.review.statuses.approved_flag.title"))- expect(page).to have_css(".reviewable-meta-data .status .approved")+ expect(refreshed_review_page).to have_reviewable_with_approved_status(Reviewable.sole)endenddiff --git a/spec/system/page_objects/pages/refreshed_review.rb b/spec/system/page_objects/pages/refreshed_review.rbindex 5d66c317e24..9c41c18630d 100644--- a/spec/system/page_objects/pages/refreshed_review.rb+++ b/spec/system/page_objects/pages/refreshed_review.rb@@ -38,6 +38,10 @@ module PageObjectswithin(reviewable_by_id(reviewable.id)) { page.has_text?("Rejected by") }end+ def has_reviewable_with_pending_status?(reviewable)+ within(reviewable_by_id(reviewable.id)) { page.has_css?(".review-item__status.--pending") }+ end+def has_reviewable_with_approved_status?(reviewable)within(reviewable_by_id(reviewable.id)) { page.has_css?(".review-item__status.--approved") }enddiff --git a/spec/system/review_filters_spec.rb b/spec/system/review_filters_spec.rbindex 98cfd656ac5..d151c614c83 100644--- a/spec/system/review_filters_spec.rb+++ b/spec/system/review_filters_spec.rb@@ -21,8 +21,8 @@ describe "Review filters", type: :system dovisit("/review?claimed_by=#{moderator.username}")- expect(page).to have_css(".reviewable-item", count: 1)- expect(page).to have_css(".reviewable-item[data-reviewable-id='#{flagged_post_1.id}']")+ expect(page).to have_css(".review-item", count: 1)+ expect(page).to have_css(".review-item[data-reviewable-id='#{flagged_post_1.id}']")endit "shows no reviewables when filtering by a user who has not claimed any" do@@ -60,7 +60,7 @@ describe "Review filters", type: :system doit "allows to filter review claimed by category group moderators" dovisit("/review")- expect(page).to have_css(".reviewable-item", count: 3)+ expect(page).to have_css(".review-item", count: 3)review_index_page.expand_filters@@ -70,8 +70,8 @@ describe "Review filters", type: :system doreview_index_page.submit_filters- expect(page).to have_css(".reviewable-item", count: 1)- expect(page).to have_css(".reviewable-item[data-reviewable-id='#{flagged_post_1.id}']")+ expect(page).to have_css(".review-item", count: 1)+ expect(page).to have_css(".review-item[data-reviewable-id='#{flagged_post_1.id}']")endendenddiff --git a/spec/system/reviewables_spec.rb b/spec/system/reviewables_spec.rbindex 5d9d13d11b9..73172fc09ad 100644--- a/spec/system/reviewables_spec.rb+++ b/spec/system/reviewables_spec.rb@@ -2,6 +2,7 @@describe "Reviewables", type: :system dolet(:review_page) { PageObjects::Pages::Review.new }+ let(:refreshed_review_page) { PageObjects::Pages::RefreshedReview.new }fab!(:admin)fab!(:theme)fab!(:long_post, :post_with_very_long_raw_content)@@ -12,20 +13,6 @@ describe "Reviewables", type: :system dobefore { sign_in(admin) }- describe "when there is a flagged post reviewable with a long post" do- fab!(:long_reviewable) { Fabricate(:reviewable_flagged_post, target: long_post) }-- it "should show a button to expand/collapse the post content" do- visit("/review")- expect(review_page).to have_post_body_collapsed- expect(review_page).to have_post_body_toggle- review_page.click_post_body_toggle- expect(review_page).to have_no_post_body_collapsed- review_page.click_post_body_toggle- expect(review_page).to have_post_body_collapsed- end- end-describe "when there is a flagged post reviewable with a short post" dofab!(:short_reviewable) { Fabricate(:reviewable_flagged_post, target: post) }@@ -103,20 +90,6 @@ describe "Reviewables", type: :system doendend- describe "when there is a queued post reviewable with a long post" do- fab!(:long_queued_reviewable, :reviewable_queued_long_post)-- it "should show a button to expand/collapse the post content" do- visit("/review")- expect(review_page).to have_post_body_collapsed- expect(review_page).to have_post_body_toggle- review_page.click_post_body_toggle- expect(review_page).to have_no_post_body_collapsed- review_page.click_post_body_toggle- expect(review_page).to have_post_body_collapsed- end- end-describe "when there is a reviewable user" dofab!(:user)let(:rejection_reason_modal) { PageObjects::Modals::RejectReasonReviewable.new }@@ -135,14 +108,13 @@ describe "Reviewables", type: :system do# cache it for later assertion instead of querying UserHistoryuser_email = user.email- review_page.visit_reviewable(reviewable)- review_page.select_bundled_action(reviewable, "user-delete_user")+ refreshed_review_page.visit_reviewable(reviewable)+ refreshed_review_page.select_bundled_action(reviewable, "user-delete_user")rejection_reason_modal.fill_in_rejection_reason(rejection_reason)rejection_reason_modal.select_send_rejection_email_checkboxrejection_reason_modal.delete_user- expect(review_page).to have_reviewable_with_rejected_status(reviewable)- expect(review_page).to have_reviewable_with_rejection_reason(reviewable, rejection_reason)+ expect(refreshed_review_page).to have_reviewable_with_rejected_status(reviewable)mail = ActionMailer::Base.deliveries.firstexpect(mail.to).to eq([user_email])@@ -155,29 +127,29 @@ describe "Reviewables", type: :system doscrubbing_reason = "a spammer who knows how to make GDPR requests"reviewable = ReviewableUser.find_by_target_id(user.id)- review_page.visit_reviewable(reviewable)- review_page.select_bundled_action(reviewable, "user-delete_user")+ refreshed_review_page.visit_reviewable(reviewable)+ refreshed_review_page.select_bundled_action(reviewable, "user-delete_user")rejection_reason_modal.fill_in_rejection_reason(rejection_reason)rejection_reason_modal.delete_user- expect(review_page).to have_reviewable_with_rejected_status(reviewable)- expect(review_page).to have_reviewable_with_rejection_reason(reviewable, rejection_reason)+ expect(refreshed_review_page).to have_reviewable_with_rejected_status(reviewable)- expect(review_page).to have_scrub_button(reviewable)- review_page.click_scrub_button(reviewable)+ refreshed_review_page.click_scrub_user_buttonexpect(scrub_user_modal.scrub_button).to be_disabledscrub_user_modal.fill_in_scrub_reason(scrubbing_reason)expect(scrub_user_modal.scrub_button).not_to be_disabledscrub_user_modal.scrub_button.click- expect(review_page).to have_reviewable_with_scrubbed_by(reviewable, admin.username)- expect(review_page).to have_reviewable_with_scrubbed_reason(reviewable, scrubbing_reason)- expect(review_page).to have_reviewable_with_scrubbed_at(+ expect(refreshed_review_page).to have_reviewable_with_scrubbed_by(reviewable, admin.username)+ expect(refreshed_review_page).to have_reviewable_with_scrubbed_reason(+ reviewable,+ scrubbing_reason,+ )+ expect(refreshed_review_page).to have_reviewable_with_scrubbed_at(reviewable,reviewable.payload["scrubbed_at"],)- expect(review_page).to have_no_scrub_button(reviewable)endend@@ -194,17 +166,18 @@ describe "Reviewables", type: :system dofab!(:queued_post_reviewable, :reviewable_queued_post)it "delete_user does not delete reviewable" do- review_page.visit_reviewable(queued_post_reviewable)+ refreshed_review_page.visit_reviewable(queued_post_reviewable)expect(queued_post_reviewable).to be_pendingexpect(queued_post_reviewable.target_created_by).to be_present- expect(review_page).to have_reviewable_action_dropdown- expect(review_page).to have_reviewable_with_pending_status(queued_post_reviewable)+ expect(refreshed_review_page).to have_reviewable_with_pending_status(queued_post_reviewable)- review_page.select_bundled_action(queued_post_reviewable, "delete_user")+ refreshed_review_page.select_bundled_action(queued_post_reviewable, "delete_user")expect(review_page).to have_no_error_dialog_visible- expect(review_page).to have_reviewable_with_rejected_status(queued_post_reviewable)+ expect(refreshed_review_page).to have_reviewable_with_rejected_status(+ queued_post_reviewable,+ )expect(review_page).to have_no_reviewable_action_dropdownexpect(queued_post_reviewable.reload).to be_rejectedexpect(queued_post_reviewable.target_created_by).to be_nil@@ -213,12 +186,12 @@ describe "Reviewables", type: :system doit "allows revising and rejecting to send a PM to the user" dorevise_modal = PageObjects::Modals::Base.new- review_page.visit_reviewable(queued_post_reviewable)+ refreshed_review_page.visit_reviewable(queued_post_reviewable)expect(queued_post_reviewable).to be_pendingexpect(queued_post_reviewable.target_created_by).to be_present- review_page.select_action(queued_post_reviewable, "revise_and_reject_post")+ refreshed_review_page.select_action(queued_post_reviewable, "revise_and_reject_post")expect(revise_modal).to be_open@@ -228,7 +201,9 @@ describe "Reviewables", type: :system dofind(".revise-and-reject-reviewable__feedback").fill_in(with: "This is a test")revise_modal.click_primary_button- expect(review_page).to have_reviewable_with_rejected_status(queued_post_reviewable)+ expect(refreshed_review_page).to have_reviewable_with_rejected_status(+ queued_post_reviewable,+ )expect(queued_post_reviewable.reload).to be_rejectedtopic = Topic.where(archetype: Archetype.private_message).last@@ -242,35 +217,15 @@ describe "Reviewables", type: :system do)end- it "claims the reviewable while revising, and unclaims it when cancelling" do- revise_modal = PageObjects::Modals::Base.new-- review_page.visit_reviewable(queued_post_reviewable)-- expect(queued_post_reviewable).to be_pending- expect(queued_post_reviewable.target_created_by).to be_present-- review_page.select_action(queued_post_reviewable, "revise_and_reject_post")-- expect(revise_modal).to be_open-- expect(page).to have_css(".claimed-actions")-- revise_modal.close-- expect(revise_modal).to be_closed- expect(page).to have_no_css(".claimed-actions")- end-it "allows selecting a custom reason for revise and reject" dorevise_modal = PageObjects::Modals::Base.new- review_page.visit_reviewable(queued_post_reviewable)+ refreshed_review_page.visit_reviewable(queued_post_reviewable)expect(queued_post_reviewable).to be_pendingexpect(queued_post_reviewable.target_created_by).to be_present- review_page.select_action(queued_post_reviewable, "revise_and_reject_post")+ refreshed_review_page.select_action(queued_post_reviewable, "revise_and_reject_post")expect(revise_modal).to be_openreason_dropdown =@@ -280,7 +235,9 @@ describe "Reviewables", type: :system dofind(".revise-and-reject-reviewable__feedback").fill_in(with: "This is a test")revise_modal.click_primary_button- expect(review_page).to have_reviewable_with_rejected_status(queued_post_reviewable)+ expect(refreshed_review_page).to have_reviewable_with_rejected_status(+ queued_post_reviewable,+ )endcontext "with reviewable claiming enabled" do