about summary refs log tree commit diff
path: root/app/services/follow_service.rb
diff options
context:
space:
mode:
authormultiple creatures <dev@multiple-creature.party>2019-05-06 20:51:20 -0500
committermultiple creatures <dev@multiple-creature.party>2019-05-21 03:16:23 -0500
commit6c374b51537126a2cba29f3eaf74faf1fc64ba96 (patch)
tree776239f0aaf7a0abed2d09440eccbb1d6d53a7a2 /app/services/follow_service.rb
parent6e8ec7f0a538b5383da49c4435835b78c61da0bc (diff)
Drop OStatus support. Fix some of the Rspec tests.
Diffstat (limited to 'app/services/follow_service.rb')
-rw-r--r--app/services/follow_service.rb37
1 files changed, 6 insertions, 31 deletions
diff --git a/app/services/follow_service.rb b/app/services/follow_service.rb
index 92d8c864a..3494dce99 100644
--- a/app/services/follow_service.rb
+++ b/app/services/follow_service.rb
@@ -29,10 +29,12 @@ class FollowService < BaseService
 
     ActivityTracker.increment('activity:interactions')
 
-    if target_account.locked? || target_account.activitypub?
-      request_follow(source_account, target_account, reblogs: reblogs)
+    if target_account.local? && !target_account.locked?
+      follow = source_account.follow!(target_account, reblogs: reblogs)
+      LocalNotificationWorker.perform_async(target_account.id, follow.id, follow.class.name)
+      follow
     else
-      direct_follow(source_account, target_account, reblogs: reblogs)
+      request_follow(source_account, target_account, reblogs: reblogs)
     end
   end
 
@@ -43,40 +45,13 @@ class FollowService < BaseService
 
     if target_account.local?
       LocalNotificationWorker.perform_async(target_account.id, follow_request.id, follow_request.class.name)
-    elsif target_account.ostatus?
-      NotificationWorker.perform_async(build_follow_request_xml(follow_request), source_account.id, target_account.id)
-      AfterRemoteFollowRequestWorker.perform_async(follow_request.id)
-    elsif target_account.activitypub?
+    else
       ActivityPub::DeliveryWorker.perform_async(build_json(follow_request), source_account.id, target_account.inbox_url)
     end
 
     follow_request
   end
 
-  def direct_follow(source_account, target_account, reblogs: true)
-    follow = source_account.follow!(target_account, reblogs: reblogs)
-
-    if target_account.local?
-      LocalNotificationWorker.perform_async(target_account.id, follow.id, follow.class.name)
-    else
-      Pubsubhubbub::SubscribeWorker.perform_async(target_account.id) unless target_account.subscribed?
-      NotificationWorker.perform_async(build_follow_xml(follow), source_account.id, target_account.id)
-      AfterRemoteFollowWorker.perform_async(follow.id)
-    end
-
-    MergeWorker.perform_async(target_account.id, source_account.id)
-
-    follow
-  end
-
-  def build_follow_request_xml(follow_request)
-    OStatus::AtomSerializer.render(OStatus::AtomSerializer.new.follow_request_salmon(follow_request))
-  end
-
-  def build_follow_xml(follow)
-    OStatus::AtomSerializer.render(OStatus::AtomSerializer.new.follow_salmon(follow))
-  end
-
   def build_json(follow_request)
     ActiveModelSerializers::SerializableResource.new(
       follow_request,