2023-05-02 20:21:14 +08:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2023-06-07 09:26:58 +08:00
|
|
|
describe "Reviewables", type: :system do
|
2023-05-02 20:21:14 +08:00
|
|
|
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
|
2024-01-03 22:49:54 +08:00
|
|
|
|
|
|
|
context "when the message is hard deleted" do
|
|
|
|
before { message_1.destroy! }
|
|
|
|
|
|
|
|
it "does not throw an error" do
|
|
|
|
visit("/review?type=Chat%3A%3AReviewableMessage")
|
|
|
|
|
|
|
|
expect(page).to have_selector(".reviewable-item.reviewable-chat-message")
|
|
|
|
end
|
|
|
|
|
|
|
|
it "adds the option to ignore the flag" do
|
|
|
|
visit("/review?type=Chat%3A%3AReviewableMessage")
|
|
|
|
|
|
|
|
expect(page).to have_selector(".reviewable-actions .chat-message-ignore")
|
|
|
|
end
|
|
|
|
end
|
2023-05-02 20:21:14 +08:00
|
|
|
end
|