about summary refs log tree commit diff
path: root/app/models
diff options
context:
space:
mode:
authorClaire <claire.github-309c@sitedethib.com>2021-10-25 21:31:10 +0200
committerGitHub <noreply@github.com>2021-10-25 21:31:10 +0200
commite0f39626973fd9f5cce2d4cd3b166fb47e9c9059 (patch)
treee02d1e9a448960a68652f75baebb5921211ee7a1 /app/models
parentc647fa99cab9b9db81d36223cf2c2c27e065b648 (diff)
parenta30ac454b2ceb381c50f5b9323e25817d784a476 (diff)
Merge pull request #1625 from ClearlyClaire/glitch-soc/merge-upstream
Merge upstream changes
Diffstat (limited to 'app/models')
-rw-r--r--app/models/concerns/account_interactions.rb4
-rw-r--r--app/models/form/account_batch.rb12
2 files changed, 5 insertions, 11 deletions
diff --git a/app/models/concerns/account_interactions.rb b/app/models/concerns/account_interactions.rb
index 8f19176a7..ad1665dc4 100644
--- a/app/models/concerns/account_interactions.rb
+++ b/app/models/concerns/account_interactions.rb
@@ -195,6 +195,10 @@ module AccountInteractions
     !following_anyone?
   end
 
+  def followed_by?(other_account)
+    other_account.following?(self)
+  end
+
   def blocking?(other_account)
     block_relationships.where(target_account: other_account).exists?
   end
diff --git a/app/models/form/account_batch.rb b/app/models/form/account_batch.rb
index 698933c9f..f1e1c8a65 100644
--- a/app/models/form/account_batch.rb
+++ b/app/models/form/account_batch.rb
@@ -43,9 +43,7 @@ class Form::AccountBatch
   end
 
   def remove_from_followers!
-    current_account.passive_relationships.where(account_id: account_ids).find_each do |follow|
-      reject_follow!(follow)
-    end
+    RemoveFromFollowersService.new.call(current_account, account_ids)
   end
 
   def block_domains!
@@ -62,14 +60,6 @@ class Form::AccountBatch
     Account.where(id: account_ids)
   end
 
-  def reject_follow!(follow)
-    follow.destroy
-
-    return unless follow.account.activitypub?
-
-    ActivityPub::DeliveryWorker.perform_async(Oj.dump(serialize_payload(follow, ActivityPub::RejectFollowSerializer)), current_account.id, follow.account.inbox_url)
-  end
-
   def approve!
     users = accounts.includes(:user).map(&:user)