about summary refs log tree commit diff
path: root/app
diff options
context:
space:
mode:
authormultiple creatures <dev@multiple-creature.party>2020-01-14 00:48:18 -0600
committermultiple creatures <dev@multiple-creature.party>2020-01-14 02:42:17 -0600
commitc236bbe60bed22bee5b986f487b6164203e3048f (patch)
tree95110c3c8117dbe046f3a4428ed5e289d3bddd7f /app
parent14326f5fd0b442684577a173df33e0b5c160ccf8 (diff)
fix the "include past roars" buttons
Diffstat (limited to 'app')
-rw-r--r--app/controllers/settings/preferences_controller.rb8
-rw-r--r--app/workers/mark_expired_statuses_worker.rb16
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