mirror of
https://github.com/discourse/discourse.git
synced 2024-11-24 06:51:04 +08:00
6c90747dea
Before this fix if the underlying model of a reviewable was changed, the filter wouldn't work anymore as it was expecting a 1:1 relation between filter type and model name. This commit also relies on the `Reviewable.types` array to check against valid types instead of a regex not checking much. Finally this commit adds a spec to ensure chat reviewables are listable from the review index page.
28 lines
712 B
Ruby
28 lines
712 B
Ruby
# frozen_string_literal: true
|
|
|
|
describe "Reviewables", type: :system, js: true do
|
|
fab!(:current_user) { Fabricate(:admin) }
|
|
fab!(:channel_1) { Fabricate(:chat_channel) }
|
|
fab!(:message_1) { Fabricate(:chat_message, chat_channel: channel_1) }
|
|
|
|
before do
|
|
chat_system_bootstrap(current_user)
|
|
channel_1.add(current_user)
|
|
sign_in(current_user)
|
|
|
|
Chat::ReviewQueue.new.flag_message(
|
|
message_1,
|
|
current_user.guardian,
|
|
ReviewableScore.types[:spam],
|
|
)
|
|
end
|
|
|
|
context "when visiting reviews for messages " do
|
|
it "lists the correct message" do
|
|
visit("/review?type=Chat%3A%3AReviewableMessage")
|
|
|
|
expect(page).to have_content(message_1.message)
|
|
end
|
|
end
|
|
end
|