about summary refs log tree commit diff
path: root/app/models/account_statuses_cleanup_policy.rb
diff options
context:
space:
mode:
authorClaire <claire.github-309c@sitedethib.com>2023-02-20 22:41:20 +0100
committerGitHub <noreply@github.com>2023-02-20 22:41:20 +0100
commit45087c1092143e95dfcc85b6c9abc5c6c0a0a5c2 (patch)
treee4be53cb0b2e7f876bea6c61d4fe64d7586ae63d /app/models/account_statuses_cleanup_policy.rb
parent4c68189d2b8b6a9a74fc13862b11bf6c6d523409 (diff)
parentdc0cc5a57d224b4c53bc58dad919b727055bd9a3 (diff)
Merge pull request #2117 from ClearlyClaire/glitch-soc/merge-upstream
Merge upstream changes
Diffstat (limited to 'app/models/account_statuses_cleanup_policy.rb')
-rw-r--r--app/models/account_statuses_cleanup_policy.rb8
1 files changed, 2 insertions, 6 deletions
diff --git a/app/models/account_statuses_cleanup_policy.rb b/app/models/account_statuses_cleanup_policy.rb
index 49adc6ad0..14ce00abb 100644
--- a/app/models/account_statuses_cleanup_policy.rb
+++ b/app/models/account_statuses_cleanup_policy.rb
@@ -122,9 +122,7 @@ class AccountStatusesCleanupPolicy < ApplicationRecord
       # may need to be deleted, so we'll have to start again.
       redis.del("account_cleanup:#{account.id}")
     end
-    if EXCEPTION_THRESHOLDS.map { |name| attribute_change_to_be_saved(name) }.compact.any? { |old, new| old.present? && (new.nil? || new > old) }
-      redis.del("account_cleanup:#{account.id}")
-    end
+    redis.del("account_cleanup:#{account.id}") if EXCEPTION_THRESHOLDS.map { |name| attribute_change_to_be_saved(name) }.compact.any? { |old, new| old.present? && (new.nil? || new > old) }
   end
 
   def validate_local_account
@@ -141,9 +139,7 @@ class AccountStatusesCleanupPolicy < ApplicationRecord
     # has switched to snowflake IDs significantly over 2 years ago anyway.
     snowflake_id = Mastodon::Snowflake.id_at(min_status_age.seconds.ago, with_random: false)
 
-    if max_id.nil? || snowflake_id < max_id
-      max_id = snowflake_id
-    end
+    max_id = snowflake_id if max_id.nil? || snowflake_id < max_id
 
     Status.where(Status.arel_table[:id].lteq(max_id))
   end