X-Git-Url: https://git.squeep.com/?a=blobdiff_plain;ds=inline;f=lib%2Fpleroma%2Flist.ex;h=fe5721c342de61fcf2b71a0f5c8c985196bdfaee;hb=c1d63bbd9a4f39dbd92811b1720705342e5c914e;hp=89aa7b5d48a04252e1f1fe163740ba1f0bb2baa0;hpb=edb659dc579fe56227adef0b0704ff13b6ef717e;p=akkoma
diff --git a/lib/pleroma/list.ex b/lib/pleroma/list.ex
index 89aa7b5d4..fe5721c34 100644
--- a/lib/pleroma/list.ex
+++ b/lib/pleroma/list.ex
@@ -1,5 +1,5 @@
# Pleroma: A lightweight social networking server
-# Copyright © 2017-2020 Pleroma Authors
+# Copyright © 2017-2021 Pleroma Authors
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.List do
@@ -113,11 +113,15 @@ defmodule Pleroma.List do
end
end
- def follow(%Pleroma.List{following: following} = list, %User{} = followed) do
+ def follow(%Pleroma.List{id: id}, %User{} = followed) do
+ list = Repo.get(Pleroma.List, id)
+ %{following: following} = list
update_follows(list, %{following: Enum.uniq([followed.follower_address | following])})
end
- def unfollow(%Pleroma.List{following: following} = list, %User{} = unfollowed) do
+ def unfollow(%Pleroma.List{id: id}, %User{} = unfollowed) do
+ list = Repo.get(Pleroma.List, id)
+ %{following: following} = list
update_follows(list, %{following: List.delete(following, unfollowed.follower_address)})
end