mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
DEV: Convert min_trust_to_edit_wiki_post to groups (#24766)
This change converts the min_trust_to_edit_wiki_post site setting to edit_wiki_post_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 email_in_min_trust setting entirely. Internal ref: /t/117248
This commit is contained in:
committed by
GitHub
parent
5140caf0e4
commit
7dd150bc95
@@ -0,0 +1,24 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class FillEditWikiPostAllowedGroupsBasedOnDeprecatedSettings < ActiveRecord::Migration[7.0]
|
||||
def up
|
||||
old_setting_trust_level =
|
||||
DB.query_single(
|
||||
"SELECT value FROM site_settings WHERE name = 'min_trust_to_edit_wiki_post' LIMIT 1",
|
||||
).first
|
||||
|
||||
if old_setting_trust_level.present?
|
||||
edit_wiki_post_allowed_groups = "1#{old_setting_trust_level}"
|
||||
|
||||
DB.exec(
|
||||
"INSERT INTO site_settings(name, value, data_type, created_at, updated_at)
|
||||
VALUES('edit_wiki_post_allowed_groups', :setting, '20', NOW(), NOW())",
|
||||
setting: edit_wiki_post_allowed_groups,
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
def down
|
||||
raise ActiveRecord::IrreversibleMigration
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user