mirror of
https://github.com/discourse/discourse.git
synced 2025-05-30 15:28:37 +08:00
DEV: Convert approve_unless_trust_level to groups (#24357)
This change converts the `approve_unless_trust_level` site setting to `approve_unless_allowed_groups`. See: https://meta.discourse.org/t/283408 - Adds the new site setting - Adds a deprecation warning - Updates core to use the new settings. - Adds a migration to fill in the new setting of the old setting was changed - Adds an entry to the site_setting.keywords section - Updates many tests to account for the new change After a couple of months we will remove the `approve_unless_trust_level` setting entirely. Internal ref: /t/115696
This commit is contained in:
@ -10,7 +10,7 @@ RSpec.describe Email::Processor do
|
||||
context "when reply via email is too short" do
|
||||
let(:mail) { file_from_fixtures("chinese_reply.eml", "emails").read }
|
||||
fab!(:post)
|
||||
fab!(:user) { Fabricate(:user, email: "discourse@bar.com") }
|
||||
fab!(:user) { Fabricate(:user, email: "discourse@bar.com", refresh_auto_groups: true) }
|
||||
|
||||
fab!(:post_reply_key) do
|
||||
Fabricate(
|
||||
|
@ -832,7 +832,7 @@ RSpec.describe Email::Receiver do
|
||||
end
|
||||
|
||||
it "accepts emails with wrong reply key if the system knows about the forwarded email" do
|
||||
Fabricate(:user, email: "bob@bar.com")
|
||||
Fabricate(:user, email: "bob@bar.com", refresh_auto_groups: true)
|
||||
Fabricate(
|
||||
:incoming_email,
|
||||
raw: <<~RAW,
|
||||
@ -1555,7 +1555,12 @@ RSpec.describe Email::Receiver do
|
||||
DiscourseEvent.on(:topic_created, &handler)
|
||||
|
||||
user =
|
||||
Fabricate(:user, email: "existing@bar.com", trust_level: SiteSetting.email_in_min_trust)
|
||||
Fabricate(
|
||||
:user,
|
||||
email: "existing@bar.com",
|
||||
trust_level: SiteSetting.email_in_min_trust,
|
||||
refresh_auto_groups: true,
|
||||
)
|
||||
group = Fabricate(:group)
|
||||
|
||||
group.add(user)
|
||||
@ -1642,10 +1647,10 @@ RSpec.describe Email::Receiver do
|
||||
end
|
||||
|
||||
it "works when approving is enabled" do
|
||||
SiteSetting.approve_unless_trust_level = 4
|
||||
SiteSetting.approve_unless_allowed_groups = Group::AUTO_GROUPS[:trust_level_4]
|
||||
|
||||
Fabricate(:user, email: "tl3@bar.com", trust_level: TrustLevel[3])
|
||||
Fabricate(:user, email: "tl4@bar.com", trust_level: TrustLevel[4])
|
||||
Fabricate(:user, email: "tl3@bar.com", trust_level: TrustLevel[3], refresh_auto_groups: true)
|
||||
Fabricate(:user, email: "tl4@bar.com", trust_level: TrustLevel[4], refresh_auto_groups: true)
|
||||
|
||||
category.set_permissions(Group[:trust_level_4] => :full)
|
||||
category.save!
|
||||
|
Reference in New Issue
Block a user