FEATURE: Separated 'trusted users can edit others' setting for trust level 3 & 4 (#21493)

This commit is contained in:
Guhyoun Nam
2023-07-07 10:48:14 -05:00
committed by GitHub
parent 25a0c00e72
commit b70bd4366b
11 changed files with 114 additions and 47 deletions

View File

@@ -0,0 +1,21 @@
# frozen_string_literal: true
class SeparateTrustedUsersCanEditOthersSiteSetting < ActiveRecord::Migration[7.0]
def up
if select_value(
"SELECT 1 FROM site_settings WHERE name = 'trusted_users_can_edit_others' AND value = 'f'",
)
execute <<~SQL
INSERT INTO site_settings (name, data_type, value, created_at, updated_at) VALUES ('edit_all_topic_groups', 20, '', now(), now());
INSERT INTO site_settings (name, data_type, value, created_at, updated_at) VALUES ('edit_all_post_groups', 20, '', now(), now());
SQL
end
end
def down
execute <<~SQL
DELETE FROM site_settings WHERE name = 'edit_all_topic_groups';
DELETE FROM site_settings WHERE name = 'edit_all_post_groups';
SQL
end
end