forked from mastodon/mastodon
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Change default to single column UI (mastodon#10847)
Keep current setting for users who were active within the last month
- Loading branch information
Showing
3 changed files
with
18 additions
and
11 deletions.
There are no files selected for viewing
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
17 changes: 17 additions & 0 deletions
17
db/migrate/20190529143559_preserve_old_layout_for_existing_users.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,17 @@ | ||
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 |
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