about summary refs log tree commit diff
path: root/app/models/form/account_batch.rb
diff options
context:
space:
mode:
authorClaire <claire.github-309c@sitedethib.com>2021-04-20 18:06:40 +0200
committerGitHub <noreply@github.com>2021-04-20 18:06:40 +0200
commit97da7b73071e9f515c4bb0bca72c88d1a13b14aa (patch)
tree89c81064b9e3725962a847e98099a5b84b728733 /app/models/form/account_batch.rb
parentdf326b8b5c0659edb2aca77690a892f228b0e099 (diff)
parent4b115d070c9a8b6082ed207bd0a14e809eded322 (diff)
Merge pull request #1521 from ClearlyClaire/glitch-soc/merge-upstream
Merge upstream changes
Diffstat (limited to 'app/models/form/account_batch.rb')
-rw-r--r--app/models/form/account_batch.rb18
1 files changed, 18 insertions, 0 deletions
diff --git a/app/models/form/account_batch.rb b/app/models/form/account_batch.rb
index 26d6d3abf..698933c9f 100644
--- a/app/models/form/account_batch.rb
+++ b/app/models/form/account_batch.rb
@@ -21,6 +21,10 @@ class Form::AccountBatch
       approve!
     when 'reject'
       reject!
+    when 'suppress_follow_recommendation'
+      suppress_follow_recommendation!
+    when 'unsuppress_follow_recommendation'
+      unsuppress_follow_recommendation!
     end
   end
 
@@ -79,4 +83,18 @@ class Form::AccountBatch
     records.each { |account| authorize(account.user, :reject?) }
            .each { |account| DeleteAccountService.new.call(account, reserve_email: false, reserve_username: false) }
   end
+
+  def suppress_follow_recommendation!
+    authorize(:follow_recommendation, :suppress?)
+
+    accounts.each do |account|
+      FollowRecommendationSuppression.create(account: account)
+    end
+  end
+
+  def unsuppress_follow_recommendation!
+    authorize(:follow_recommendation, :unsuppress?)
+
+    FollowRecommendationSuppression.where(account_id: account_ids).destroy_all
+  end
 end