mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2024-11-11 01:44:34 +08:00
Merge pull request #6776 from artoscinote/ma_SCI_9695
Migrate old user notification settings [SCI-9695]
This commit is contained in:
commit
1f3dca6104
1 changed files with 24 additions and 0 deletions
24
db/migrate/20231207092907_migrate_notification_settings.rb
Normal file
24
db/migrate/20231207092907_migrate_notification_settings.rb
Normal file
|
@ -0,0 +1,24 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class MigrateNotificationSettings < ActiveRecord::Migration[7.0]
|
||||
def up
|
||||
User.find_each do |user|
|
||||
user.settings[:notifications_settings] =
|
||||
user.settings[:notifications_settings].merge(Extends::DEFAULT_USER_NOTIFICATION_SETTINGS)
|
||||
|
||||
user.settings[:notifications_settings][:project_experiment_access] = {
|
||||
in_app: user.settings.dig(:notifications_settings, :assignments),
|
||||
email: user.settings.dig(:notifications_settings, :assignments_email)
|
||||
}
|
||||
|
||||
user.settings[:notifications_settings][:other_team_invitation] = {
|
||||
in_app: user.settings.dig(:notifications_settings, :assignments),
|
||||
email: user.settings.dig(:notifications_settings, :assignments_email)
|
||||
}
|
||||
|
||||
user.save!
|
||||
end
|
||||
end
|
||||
|
||||
def down; end
|
||||
end
|
Loading…
Reference in a new issue