commit: e239fc30503ceaf9ae6ba51233ac3394dcd766f5
parent: d0229754442dc824dc38bf99344052b3931998f8
Author: Eugen Rochko <eugen@zeonfederated.com>
Date: Wed, 16 Mar 2016 21:23:40 +0100
Fix error when unfollowing somebody who wasn't followed in the first place
Diffstat:
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/app/models/account.rb b/app/models/account.rb
@@ -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)