]> cat aescling's git repositories - mastodon.git/commitdiff
Disallow self-follow
authorEugen Rochko <eugen@zeonfederated.com>
Sat, 10 Sep 2016 08:01:08 +0000 (10:01 +0200)
committerEugen Rochko <eugen@zeonfederated.com>
Sat, 10 Sep 2016 08:01:08 +0000 (10:01 +0200)
app/services/follow_service.rb

index e4a4bfcd3420e1dd880878509929291921e93f36..b775d3519ff3f7eb355836f5f17c0a79268e3d5b 100644 (file)
@@ -5,7 +5,7 @@ class FollowService < BaseService
   def call(source_account, uri)
     target_account = follow_remote_account_service.(uri)
 
-    return nil if target_account.nil?
+    return nil if target_account.nil? || target_account.id == source_account.id
 
     follow = source_account.follow!(target_account)