DEV: Convert min_trust_to_create_topic to groups (#24740)

This change converts the min_trust_to_create_topic site setting to
create_topic_allowed_groups.

See: https://meta.discourse.org/t/283408

- Hides the old setting
- Adds the new site setting
- Add a deprecation warning
- Updates to use the new setting
- Adds a migration to fill in the new setting if the old setting was
changed
- Adds an entry to the site_setting.keywords section
- Updates tests to account for the new change
- After a couple of months, we will remove the min_trust_to_create_topicsetting entirely.

Internal ref: /t/117248
This commit is contained in:
Krzysztof Kotlarek
2023-12-13 14:50:13 +11:00
committed by GitHub
parent 1017820012
commit 702d0620d7
41 changed files with 169 additions and 76 deletions

View File

@ -4,10 +4,10 @@ require "post_creator"
require "topic_subtype"
RSpec.describe PostCreator do
fab!(:user)
fab!(:admin)
fab!(:coding_horror)
fab!(:evil_trout)
fab!(:user) { Fabricate(:user, refresh_auto_groups: true) }
fab!(:admin) { Fabricate(:admin, refresh_auto_groups: true) }
fab!(:coding_horror) { Fabricate(:coding_horror, refresh_auto_groups: true) }
fab!(:evil_trout) { Fabricate(:evil_trout, refresh_auto_groups: true) }
let(:topic) { Fabricate(:topic, user: user) }
describe "new topic" do
@ -1578,7 +1578,7 @@ RSpec.describe PostCreator do
end
describe "staged users" do
fab!(:staged)
fab!(:staged) { Fabricate(:staged, refresh_auto_groups: true) }
it "automatically watches all messages it participates in" do
post =
@ -2065,9 +2065,9 @@ RSpec.describe PostCreator do
end
describe "#create_post_notice" do
fab!(:user)
fab!(:staged)
fab!(:anonymous)
fab!(:user) { Fabricate(:user, refresh_auto_groups: true) }
fab!(:staged) { Fabricate(:staged, refresh_auto_groups: true) }
fab!(:anonymous) { Fabricate(:anonymous, refresh_auto_groups: true) }
it "generates post notices for new users" do
post =