From 153bffcaf275e13201068c90b4400b5b6decf496 Mon Sep 17 00:00:00 2001 From: Zach Gollwitzer Date: Wed, 14 May 2025 12:52:21 -0400 Subject: [PATCH] Add migration to clear stale syncs on self hosted apps --- app/assets/tailwind/maybe-design-system.css | 11 +---------- app/controllers/users_controller.rb | 2 +- .../20250512171654_update_sync_timestamps.rb | 14 ++++++++++++++ db/schema.rb | 3 +-- 4 files changed, 17 insertions(+), 13 deletions(-) diff --git a/app/assets/tailwind/maybe-design-system.css b/app/assets/tailwind/maybe-design-system.css index bfca010d..f9dc6039 100644 --- a/app/assets/tailwind/maybe-design-system.css +++ b/app/assets/tailwind/maybe-design-system.css @@ -240,16 +240,7 @@ 100% { stroke-dashoffset: 0; } - } - - @keyframes shiny-wave { - 0% { - background-position: -200% 0; - } - 100% { - background-position: 200% 0; - } - } + } } /* Specific override for strong tags in prose under dark mode */ diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 4cad0863..2b3c0866 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -87,7 +87,7 @@ class UsersController < ApplicationController def user_params params.require(:user).permit( - :first_name, :last_name, :email, :profile_image, :redirect_to, :delete_profile_image, :onboarded_at, :preferred_account_group_tab, + :first_name, :last_name, :email, :profile_image, :redirect_to, :delete_profile_image, :onboarded_at, :show_sidebar, :default_period, :show_ai_sidebar, :ai_enabled, :theme, :set_onboarding_preferences_at, :set_onboarding_goals_at, family_attributes: [ :name, :currency, :country, :locale, :date_format, :timezone, :id ], goals: [] diff --git a/db/migrate/20250512171654_update_sync_timestamps.rb b/db/migrate/20250512171654_update_sync_timestamps.rb index 716f7019..81c1658f 100644 --- a/db/migrate/20250512171654_update_sync_timestamps.rb +++ b/db/migrate/20250512171654_update_sync_timestamps.rb @@ -28,6 +28,20 @@ class UpdateSyncTimestamps < ActiveRecord::Migration[7.2] UPDATE syncs SET window_start_date = start_date SQL + + # Due to some recent bugs, some self hosters have syncs that are stuck. + # This manually fails those syncs so they stop seeing syncing UI notices. + if Rails.application.config.app_mode.self_hosted? + puts "Self hosted: Fail syncs older than 2 hours" + execute <<-SQL + UPDATE syncs + SET status = 'failed' + WHERE ( + status = 'syncing' AND + created_at < NOW() - INTERVAL '2 hours' + ) + SQL + end end dir.down do diff --git a/db/schema.rb b/db/schema.rb index 04b8548b..10ac65c8 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -10,7 +10,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema[7.2].define(version: 2025_05_14_143017) do +ActiveRecord::Schema[7.2].define(version: 2025_05_13_122703) do # These are extensions that must be enabled in order to support this database enable_extension "pgcrypto" enable_extension "plpgsql" @@ -696,7 +696,6 @@ ActiveRecord::Schema[7.2].define(version: 2025_05_14_143017) do t.text "goals", default: [], array: true t.datetime "set_onboarding_preferences_at" t.datetime "set_onboarding_goals_at" - t.string "preferred_account_group_tab", default: "asset" t.index ["email"], name: "index_users_on_email", unique: true t.index ["family_id"], name: "index_users_on_family_id" t.index ["last_viewed_chat_id"], name: "index_users_on_last_viewed_chat_id"