Skip to content

Commit e239fc3

Browse files
committed
Fix error when unfollowing somebody who wasn't followed in the first place
1 parent d022975 commit e239fc3

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

app/models/account.rb

+2-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,8 @@ def follow!(other_account)
3636
end
3737

3838
def unfollow!(other_account)
39-
self.active_relationships.find_by(target_account: other_account).destroy
39+
follow = self.active_relationships.find_by(target_account: other_account)
40+
follow.destroy unless follow.nil?
4041
end
4142

4243
def following?(other_account)

0 commit comments

Comments
 (0)