This repository has been archived on 2024-07-31. You can view files and clone it, but cannot push or open issues or pull requests.
2019-05-30 07:30:38 -04:00
|
|
|
class PreserveOldLayoutForExistingUsers < ActiveRecord::Migration[5.2]
|
|
|
|
disable_ddl_transaction!
|
|
|
|
|
|
|
|
def up
|
|
|
|
# Assume that currently active users are already using the layout that they
|
|
|
|
# want to use, therefore ensure that it is saved explicitly and not based
|
|
|
|
# on the to-be-changed default
|
|
|
|
|
|
|
|
User.where(User.arel_table[:current_sign_in_at].gteq(1.month.ago)).find_each do |user|
|
|
|
|
next if Setting.unscoped.where(thing_type: 'User', thing_id: user.id, var: 'advanced_layout').exists?
|
2023-02-20 00:58:28 -05:00
|
|
|
|
2019-05-30 07:30:38 -04:00
|
|
|
user.settings.advanced_layout = true
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2023-02-19 20:18:54 -05:00
|
|
|
def down; end
|
2019-05-30 07:30:38 -04:00
|
|
|
end
|