mirror of
https://github.com/mastodon/mastodon.git
synced 2024-10-21 10:05:39 +09:00
18 lines
580 B
Ruby
18 lines
580 B
Ruby
|
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?
|
||
|
user.settings.advanced_layout = true
|
||
|
end
|
||
|
end
|
||
|
|
||
|
def down
|
||
|
end
|
||
|
end
|