forked from mastodon/mastodon
-
-
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.
Migrate existing
open_registrations
setting to the new `registratio…
…ns_mode` (mastodon#10269) * Migrate existing `open_registrations` setting to the new `registrations_mode` Fixes mastodon#10263 * Remove unrelated db changes that have creeped in
- Loading branch information
1 parent
5c71049
commit 2c57921
Showing
2 changed files
with
16 additions
and
14 deletions.
There are no files selected for viewing
15 changes: 15 additions & 0 deletions
15
db/migrate/20190314181829_migrate_open_registrations_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,15 @@ | ||
class MigrateOpenRegistrationsSetting < ActiveRecord::Migration[5.2] | ||
def up | ||
open_registrations = Setting.find_by(var: 'open_registrations') | ||
return if open_registrations.nil? || open_registrations.value | ||
setting = Setting.where(var: 'registrations_mode').first_or_initialize(var: 'registrations_mode') | ||
setting.update(value: 'none') | ||
end | ||
|
||
def down | ||
registrations_mode = Setting.find_by(var: 'registrations_mode') | ||
return if registrations_mode.nil? | ||
setting = Setting.where(var: 'open_registrations').first_or_initialize(var: 'open_registrations') | ||
setting.update(value: registrations_mode.value == 'open') | ||
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