]> cat aescling's git repositories - mastodon.git/commitdiff
Change default to single column UI (#10847)
authorEugen Rochko <eugen@zeonfederated.com>
Thu, 30 May 2019 11:30:38 +0000 (14:30 +0300)
committerGitHub <noreply@github.com>
Thu, 30 May 2019 11:30:38 +0000 (14:30 +0300)
Keep current setting for users who were active within the last month

config/settings.yml
db/migrate/20190529143559_preserve_old_layout_for_existing_users.rb [new file with mode: 0644]
db/schema.rb

index 0c35106995d20c57f4022e903496a00b69666be9..805624d3e1e165593ca7952d038f7e8119c8aa97 100644 (file)
@@ -31,7 +31,7 @@ defaults: &defaults
   noindex: false
   theme: 'default'
   aggregate_reblogs: true
-  advanced_layout: true
+  advanced_layout: false
   notification_emails:
     follow: false
     reblog: false
diff --git a/db/migrate/20190529143559_preserve_old_layout_for_existing_users.rb b/db/migrate/20190529143559_preserve_old_layout_for_existing_users.rb
new file mode 100644 (file)
index 0000000..72b7c60
--- /dev/null
@@ -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
index cff545be5672fe8451c51267e2971431fa53dd86..f633f4e3fb7df7dcff0ad5a01a629e32593dd2ae 100644 (file)
@@ -10,7 +10,7 @@
 #
 # It's strongly recommended that you check this file into your version control system.
 
-ActiveRecord::Schema.define(version: 2019_05_19_130537) do
+ActiveRecord::Schema.define(version: 2019_05_29_143559) do
 
   # These are extensions that must be enabled in order to support this database
   enable_extension "plpgsql"