X-Git-Url: http://git.squeep.com/?a=blobdiff_plain;ds=sidebyside;f=lib%2Fpleroma%2Ffollowing_relationship.ex;h=a6d28115137b32cb5ec30026f87461c20971930b;hb=c2e415143b1dfe5d89eff06fbce6840c445aa5fa;hp=40538f7bf17586bd557f0522bcd61f5c94b91f76;hpb=e6d7e27bd603806e96dfc2774f90cadb3cf73a8c;p=akkoma
diff --git a/lib/pleroma/following_relationship.ex b/lib/pleroma/following_relationship.ex
index 40538f7bf..a6d281151 100644
--- a/lib/pleroma/following_relationship.ex
+++ b/lib/pleroma/following_relationship.ex
@@ -1,5 +1,5 @@
# Pleroma: A lightweight social networking server
-# Copyright © 2017-2019 Pleroma Authors
+# Copyright © 2017-2020 Pleroma Authors
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.FollowingRelationship do
@@ -58,8 +58,8 @@ defmodule Pleroma.FollowingRelationship do
def unfollow(%User{} = follower, %User{} = following) do
case get(follower, following) do
- nil -> {:ok, nil}
%__MODULE__{} = following_relationship -> Repo.delete(following_relationship)
+ _ -> {:ok, nil}
end
end
@@ -101,7 +101,7 @@ defmodule Pleroma.FollowingRelationship do
|> select([r, u], u.follower_address)
|> Repo.all()
- if not user.local or user.nickname in [nil, "internal.fetch"] do
+ if not user.local or user.invisible do
following
else
[user.follower_address | following]
@@ -121,8 +121,12 @@ defmodule Pleroma.FollowingRelationship do
Pleroma.Web.CommonAPI.follow(following_relationship.follower, target)
end)
|> case do
- [] -> :ok
- _ -> move_following(origin, target)
+ [] ->
+ User.update_follower_count(origin)
+ :ok
+
+ _ ->
+ move_following(origin, target)
end
end
end