diff options
Diffstat (limited to 'app')
-rw-r--r-- | app/controllers/settings/preferences_controller.rb | 8 | ||||
-rw-r--r-- | app/workers/mark_expired_statuses_worker.rb | 16 |
2 files changed, 13 insertions, 11 deletions
diff --git a/app/controllers/settings/preferences_controller.rb b/app/controllers/settings/preferences_controller.rb index 295fc3129..feebabbc8 100644 --- a/app/controllers/settings/preferences_controller.rb +++ b/app/controllers/settings/preferences_controller.rb @@ -12,11 +12,7 @@ class Settings::PreferencesController < Settings::BaseController def update user_settings.update(user_settings_params.to_h) - MarkExpiredStatusesWorker.perform_async( - current_account.id, - truthy_param?(:setting_defederate_old), - truthy_param?(:setting_lifespan_old) - ) + MarkExpiredStatusesWorker.perform_async(current_account.id) if current_user.update(user_params) I18n.locale = current_user.locale @@ -91,7 +87,9 @@ class Settings::PreferencesController < Settings::BaseController :setting_max_public_history, :setting_max_public_access, :setting_roar_lifespan, + :setting_roar_lifespan_old, :setting_roar_defederate, + :setting_roar_defederate_old, :setting_delayed_roars, :setting_delayed_for, :setting_boost_interval, diff --git a/app/workers/mark_expired_statuses_worker.rb b/app/workers/mark_expired_statuses_worker.rb index 9eac58357..ef39d205d 100644 --- a/app/workers/mark_expired_statuses_worker.rb +++ b/app/workers/mark_expired_statuses_worker.rb @@ -5,16 +5,15 @@ class MarkExpiredStatusesWorker sidekiq_options queue: 'bulk' - def perform(account_id, defederate = false, lifespan = false) + def perform(account_id) @account = Account.find(account_id) return if @account&.user.nil? - @user = @account.user - @roar_defederate = @user.roar_defederate.to_i - @roar_lifespan = @user.roar_lifespan.to_i + @roar_defederate = @account.user.roar_defederate + @roar_lifespan = @account.user.roar_lifespan - defederate = false if @roar_defederate == 0 - lifespan = false if @roar_lifespan == 0 + defederate = @account.user.roar_defederate_old && @roar_defederate != 0 + lifespan = @account.user.roar_lifespan_old && @roar_lifespan != 0 return unless defederate || lifespan @@ -38,6 +37,11 @@ class MarkExpiredStatusesWorker offset += 1.second end end + + UserSettingsDecorator.new(@account.user).update({ + 'setting_roar_defederate_old' => false, + 'setting_roar_lifespan_old' => false, + }) rescue ActiveRecord::RecordNotFound true end |