forked from discourse/discourse
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
DEV: Convert review_media_unless_trust_level to group-based setting (d…
…iscourse#25201) This commit moves the review_media_unless_trust_level setting to skip_review_media_groups as part of our move from TL to group based settings. c.f. https://meta.discourse.org/t/changes-coming-to-settings-for-giving-access-to-features-from-trust-levels-to-groups/283408
- Loading branch information
1 parent
6ebe61e
commit 08d641d
Showing
8 changed files
with
47 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
db/post_migrate/20240110040813_fill_skip_review_media_groups_based_on_deprecated_setting.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# frozen_string_literal: true | ||
|
||
class FillSkipReviewMediaGroupsBasedOnDeprecatedSetting < ActiveRecord::Migration[7.0] | ||
def up | ||
old_setting_trust_level = | ||
DB.query_single( | ||
"SELECT value FROM site_settings WHERE name = 'review_media_unless_trust_level' LIMIT 1", | ||
).first | ||
|
||
if old_setting_trust_level.present? | ||
allowed_groups = "1#{old_setting_trust_level}" | ||
|
||
DB.exec( | ||
"INSERT INTO site_settings(name, value, data_type, created_at, updated_at) | ||
VALUES('skip_review_media_groups', :setting, '20', NOW(), NOW())", | ||
setting: allowed_groups, | ||
) | ||
end | ||
end | ||
|
||
def down | ||
raise ActiveRecord::IrreversibleMigration | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters