DEV: Remove usages of enable_personal_messages (#18437)

cf. e62e93f83a

This PR also makes it so `bot` (negative ID) and `system` users are always allowed
to send PMs, since the old conditional was just based on `enable_personal_messages`
This commit is contained in:
Martin Brennan
2022-10-05 10:50:20 +10:00
committed by GitHub
parent 2d391565e4
commit f5194aadd3
28 changed files with 117 additions and 46 deletions

View File

@@ -410,6 +410,7 @@ RSpec.describe TopicCreator do
TopicCreator.any_instance.expects(:watch_topic).returns(true)
SiteSetting.allow_duplicate_topic_titles = true
SiteSetting.enable_staged_users = true
Group.refresh_automatic_groups!
end
it "should be possible for a regular user to send private message" do
@@ -442,7 +443,6 @@ RSpec.describe TopicCreator do
end
it "personal_message_enabled_groups setting should be checked when sending private message" do
SiteSetting.enable_personal_messages = false
SiteSetting.personal_message_enabled_groups = Group::AUTO_GROUPS[:trust_level_4]
expect do
@@ -452,6 +452,10 @@ RSpec.describe TopicCreator do
end
context 'with to emails' do
before do
Group.refresh_automatic_groups!
end
it 'works for staff' do
SiteSetting.min_trust_to_send_email_messages = 'staff'
expect(TopicCreator.create(admin, Guardian.new(admin), pm_to_email_valid_attrs)).to be_valid