about summary refs log tree commit diff
path: root/app/workers
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/workers
parent14326f5fd0b442684577a173df33e0b5c160ccf8 (diff)
fix the "include past roars" buttons
Diffstat (limited to 'app/workers')
-rw-r--r--app/workers/mark_expired_statuses_worker.rb16
1 files changed, 10 insertions, 6 deletions
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