]> cat aescling's git repositories - mastodon.git/commitdiff
Fix error when unfollowing somebody who wasn't followed in the first place
authorEugen Rochko <eugen@zeonfederated.com>
Wed, 16 Mar 2016 20:23:40 +0000 (21:23 +0100)
committerEugen Rochko <eugen@zeonfederated.com>
Wed, 16 Mar 2016 20:23:40 +0000 (21:23 +0100)
app/models/account.rb

index c92bb157478540c7d650ee9014d78b0e38fc1c30..524d05f867a00adad74e4857468d1192f9b7dd5c 100644 (file)
@@ -36,7 +36,8 @@ class Account < ActiveRecord::Base
   end
 
   def unfollow!(other_account)
-    self.active_relationships.find_by(target_account: other_account).destroy
+    follow = self.active_relationships.find_by(target_account: other_account)
+    follow.destroy unless follow.nil?
   end
 
   def following?(other_account)