about summary refs log tree commit diff
diff options
context:
space:
mode:
authorJeong Arm <kjwonmail@gmail.com>2021-10-15 04:11:14 +0900
committerGitHub <noreply@github.com>2021-10-14 21:11:14 +0200
commitf4081d15647c5fb4e6b4a1020518d4cf44d7a7c0 (patch)
tree213098c701bcc206edb808b0d10ef5ea3a3e2aea
parent3f5f4273b3c2b61d71b64652f75a0d99b7a407bb (diff)
Allow keeping only 1 boosts/favs on auto deleting posts (#16653)
* Allow keeping 1 boosts/favs on auto deleting posts

* Fix tests
-rw-r--r--app/models/account_statuses_cleanup_policy.rb4
-rw-r--r--config/locales/en.yml8
-rw-r--r--spec/models/account_statuses_cleanup_policy_spec.rb8
3 files changed, 10 insertions, 10 deletions
diff --git a/app/models/account_statuses_cleanup_policy.rb b/app/models/account_statuses_cleanup_policy.rb
index 705ccff54..0a9551ec2 100644
--- a/app/models/account_statuses_cleanup_policy.rb
+++ b/app/models/account_statuses_cleanup_policy.rb
@@ -164,8 +164,8 @@ class AccountStatusesCleanupPolicy < ApplicationRecord
 
   def without_popular_scope
     scope = Status.left_joins(:status_stat)
-    scope = scope.where('COALESCE(status_stats.reblogs_count, 0) <= ?', min_reblogs) unless min_reblogs.nil?
-    scope = scope.where('COALESCE(status_stats.favourites_count, 0) <= ?', min_favs) unless min_favs.nil?
+    scope = scope.where('COALESCE(status_stats.reblogs_count, 0) < ?', min_reblogs) unless min_reblogs.nil?
+    scope = scope.where('COALESCE(status_stats.favourites_count, 0) < ?', min_favs) unless min_favs.nil?
     scope
   end
 end
diff --git a/config/locales/en.yml b/config/locales/en.yml
index 5ad5767c9..be15ad4b0 100644
--- a/config/locales/en.yml
+++ b/config/locales/en.yml
@@ -1332,10 +1332,10 @@ en:
       '63113904': 2 years
       '7889238': 3 months
     min_age_label: Age threshold
-    min_favs: Keep posts favourited more than
-    min_favs_hint: Doesn't delete any of your posts that has received more than this amount of favourites. Leave blank to delete posts regardless of their number of favourites
-    min_reblogs: Keep posts boosted more than
-    min_reblogs_hint: Doesn't delete any of your posts that has been boosted more than this number of times. Leave blank to delete posts regardless of their number of boosts
+    min_favs: Keep posts favourited at least
+    min_favs_hint: Doesn't delete any of your posts that has received at least this amount of favourites. Leave blank to delete posts regardless of their number of favourites
+    min_reblogs: Keep posts boosted at least
+    min_reblogs_hint: Doesn't delete any of your posts that has been boosted at least this number of times. Leave blank to delete posts regardless of their number of boosts
   stream_entries:
     pinned: Pinned post
     reblogged: boosted
diff --git a/spec/models/account_statuses_cleanup_policy_spec.rb b/spec/models/account_statuses_cleanup_policy_spec.rb
index 63e9c5d20..4732ad625 100644
--- a/spec/models/account_statuses_cleanup_policy_spec.rb
+++ b/spec/models/account_statuses_cleanup_policy_spec.rb
@@ -499,9 +499,9 @@ RSpec.describe AccountStatusesCleanupPolicy, type: :model do
       end
     end
 
-    context 'when policy is to keep statuses with more than 4 boosts' do
+    context 'when policy is to keep statuses with at least 5 boosts' do
       before do
-        account_statuses_cleanup_policy.min_reblogs = 4
+        account_statuses_cleanup_policy.min_reblogs = 5
       end
 
       it 'does not return the recent toot' do
@@ -521,9 +521,9 @@ RSpec.describe AccountStatusesCleanupPolicy, type: :model do
       end
     end
 
-    context 'when policy is to keep statuses with more than 4 favs' do
+    context 'when policy is to keep statuses with at least 5 favs' do
       before do
-        account_statuses_cleanup_policy.min_favs = 4
+        account_statuses_cleanup_policy.min_favs = 5
       end
 
       it 'does not return the recent toot' do