]> cat aescling's git repositories - mastodon.git/commitdiff
Allow keeping only 1 boosts/favs on auto deleting posts (#16653)
authorJeong Arm <kjwonmail@gmail.com>
Thu, 14 Oct 2021 19:11:14 +0000 (04:11 +0900)
committerGitHub <noreply@github.com>
Thu, 14 Oct 2021 19:11:14 +0000 (21:11 +0200)
* Allow keeping 1 boosts/favs on auto deleting posts

* Fix tests

app/models/account_statuses_cleanup_policy.rb
config/locales/en.yml
spec/models/account_statuses_cleanup_policy_spec.rb

index 705ccff54d2dfcb174e21e22261b0353d8952fe5..0a9551ec2850a17a9ee1b3a886ebda400c8af275 100644 (file)
@@ -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
index 5ad5767c9fa1dbe7dcc0e3ad34f19255ffe81359..be15ad4b0572b8e6b2cff23a6e27db33998ef2f5 100644 (file)
@@ -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
index 63e9c5d20348149911e76531618dc37f2553ad4e..4732ad625dea4dab8efcd25cbd0aa3b8afbc399b 100644 (file)
@@ -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