0
0
Fork 0
mirror of https://github.com/discourse/discourse.git synced 2026-08-05 19:53:47 +08:00
discourse/spec/system/private_message_spec.rb
Martin Brennan bf3ccea89f
FEATURE: Change default upcoming change promotion status to Beta (#41275)
We think this system is tested well enough now to make the default
promotion status for upcoming changes to Beta instead of Stable. This
will mostly affect self-hosters as on our own hosting we set
different promotion statuses based on billing tier.
2026-07-06 09:13:37 +10:00

63 lines
2.1 KiB
Ruby
Vendored

# frozen_string_literal: true
describe "Private Message" do
let(:sender) { Fabricate(:user, refresh_auto_groups: true) }
let(:recipient) { Fabricate(:user) }
let(:pm_post) { Fabricate(:private_message_post, user: sender, recipient: recipient) }
let(:pm_post_obj) { PageObjects::Components::Post.new(pm_post.post_number) }
let(:composer) { PageObjects::Components::Composer.new }
context "when being removed from private conversation" do
before { sign_in(recipient) }
it "redirects away from the private message" do
visit(pm_post.full_url)
expect(page).to have_css("h1", text: pm_post.topic.title)
pm_post.topic.remove_allowed_user(sender, recipient)
expect(page).to have_current_path("/u/#{recipient.username}/messages")
expect(page).to have_no_css("h1", text: pm_post.topic.title)
end
end
context "for 'new personal message' action option in composer" do
before { sign_in(sender) }
it "should be available in new topic" do
visit "/new-topic"
expect(composer).to be_opened
composer.open_composer_actions_new
composer.select_action_by_id("create_private_message")
expect(composer.button_label).to have_text(I18n.t("js.composer.create_pm"))
end
it "should not be available in private conversation reply" do
visit(pm_post.full_url)
pm_post_obj.reply
expect(composer).to be_opened
composer.open_composer_actions_new
expect(composer).to have_no_action_id("create_private_message")
end
it "can switch between topic and personal message modes" do
visit "/new-topic"
expect(composer).to be_opened
# Switch to personal message
composer.open_composer_actions_new
composer.select_action_by_id("create_private_message")
expect(composer.button_label).to have_text(I18n.t("js.composer.create_pm"))
# Switch back to topic
composer.open_composer_actions_new
composer.select_action_by_id("create_topic")
expect(composer.button_label).to have_text(I18n.t("js.composer.create_topic"))
end
end
end