From 94b87c0f6ad827aed136cd8d162c38cea543145a Mon Sep 17 00:00:00 2001 From: Eugene Burmakin Date: Wed, 26 Feb 2025 20:21:20 +0100 Subject: [PATCH] Activate self-hosted users by default --- .../20250226192005_activate_selfhosted_users.rb | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 db/data/20250226192005_activate_selfhosted_users.rb diff --git a/db/data/20250226192005_activate_selfhosted_users.rb b/db/data/20250226192005_activate_selfhosted_users.rb new file mode 100644 index 00000000..ffb00583 --- /dev/null +++ b/db/data/20250226192005_activate_selfhosted_users.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +class ActivateSelfhostedUsers < ActiveRecord::Migration[8.0] + def up + return unless DawarichSettings.self_hosted? + + User.update_all(status: :active) # rubocop:disable Rails/SkipsModelValidations + end + + def down + return unless DawarichSettings.self_hosted? + + User.update_all(status: :inactive) # rubocop:disable Rails/SkipsModelValidations + end +end