about summary refs log tree commit diff
diff options
context:
space:
mode:
authorEugen Rochko <eugen@zeonfederated.com>2019-05-30 14:30:38 +0300
committermultiple creatures <dev@multiple-creature.party>2019-11-19 16:15:00 -0600
commit35d85c1622248e9c2b3b64d797c603ac5a903f0f (patch)
tree514a0a03d56fb621ebb79b3e51dbd5892d95b4bf
parente1ff8b2397d991844b1718b527cc646295d6e300 (diff)
Change default to single column UI (#10847)
Keep current setting for users who were active within the last month
-rw-r--r--config/settings.yml2
-rw-r--r--db/migrate/20190529143559_preserve_old_layout_for_existing_users.rb17
-rw-r--r--db/schema.rb10
3 files changed, 18 insertions, 11 deletions
diff --git a/config/settings.yml b/config/settings.yml
index b0d3dfa3a..65e7a7871 100644
--- a/config/settings.yml
+++ b/config/settings.yml
@@ -35,7 +35,7 @@ defaults: &defaults
   flavour: 'glitch'
   skin: '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
index 000000000..72b7c609d
--- /dev/null
+++ b/db/migrate/20190529143559_preserve_old_layout_for_existing_users.rb
@@ -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
diff --git a/db/schema.rb b/db/schema.rb
index 63897a0e7..e2c8256b2 100644
--- a/db/schema.rb
+++ b/db/schema.rb
@@ -208,16 +208,6 @@ ActiveRecord::Schema.define(version: 2019_11_18_102858) do
     t.index ["target_account_id"], name: "index_blocks_on_target_account_id"
   end
 
-  create_table "bookmarks", force: :cascade do |t|
-    t.bigint "account_id", null: false
-    t.bigint "status_id", null: false
-    t.datetime "created_at", null: false
-    t.datetime "updated_at", null: false
-    t.index ["account_id", "status_id"], name: "index_bookmarks_on_account_id_and_status_id", unique: true
-    t.index ["account_id"], name: "index_bookmarks_on_account_id"
-    t.index ["status_id"], name: "index_bookmarks_on_status_id"
-  end
-
   create_table "conversation_mutes", force: :cascade do |t|
     t.bigint "conversation_id", null: false
     t.bigint "account_id", null: false