discourse-akismet/spec/system/viewing_reviewable_akismet_post_spec.rb
Krzysztof Kotlarek e3bf8a98df
DEV: Remove legacy reviewable UI code (#203)
What is the problem?

The reviewable UI refresh has been fully rolled out in Discourse core
(discourse/discourse#36752), which removes the `reviewable_old_moderator_actions`
site setting, deletes the `reviewable-refresh/` component directory, and
renames the `RefreshedReview` page object to `Review`. Plugins need to be
updated to align with these changes.

What is the solution?

- Delete legacy reviewable components (`reviewable-akismet-post.gjs`,
   `reviewable-akismet-user.gjs`, `reviewable-akismet-post-voting-comment.gjs`)
   that were used by the old UI
- Move `reviewable-refresh/` components to `reviewable/` and update imports
  to reference the new canonical paths (e.g. `reviewable/post` instead of
  `reviewable-refresh/post`)
- Rename `build_legacy_combined_actions` to `build_combined_actions` and
   `build_legacy_action` to `build_action` in all three reviewable models
- Remove `build_new_separated_actions` methods that are no longer needed
- Update system tests to use `Pages::Review` instead of `Pages::RefreshedReview`
   and remove references to the deleted `reviewable_old_moderator_actions` setting
2026-02-24 13:58:39 +08:00

54 lines
1.5 KiB
Ruby

# frozen_string_literal: true
describe "Viewing reviewable akismet post" do
fab!(:admin)
fab!(:post)
fab!(:reviewable) { Fabricate(:reviewable_akismet_post, target: post, topic: post.topic) }
let(:review_page) { PageObjects::Pages::Review.new }
before { sign_in(admin) }
it "allows user to confirm reviewable as spam" do
review_page.visit_reviewable(reviewable)
expect(page).to have_text(post.raw)
page.find(".post-confirm-spam").click
expect(review_page).to have_reviewable_with_approved_status(reviewable)
end
it "allows the reviewer to mark the reviewable as not spam" do
post.trash!(admin)
review_page.visit_reviewable(reviewable)
review_page.select_bundled_action(reviewable, "post-not_spam")
expect(review_page).to have_reviewable_with_rejected_status(reviewable)
end
it "allows the reviewer to mark the reviewable as ignored" do
review_page.visit_reviewable(reviewable)
review_page.select_bundled_action(reviewable, "post-ignore")
expect(review_page).to have_reviewable_with_ignored_status(reviewable)
end
it "shows API errors if present" do
reviewable.update(
payload: {
post_cooked: post.cooked,
external_error: {
error: "Rate limit exceeded",
code: 429,
msg: "Too many requests",
},
},
)
review_page.visit_reviewable(reviewable)
expect(page).to have_text("Akismet API Error:")
expect(page).to have_text("Rate limit exceeded")
end
end