X-Git-Url: https://git.squeep.com/?a=blobdiff_plain;ds=sidebyside;f=lib%2Fpleroma%2Flist.ex;h=fe5721c342de61fcf2b71a0f5c8c985196bdfaee;hb=e8806fdc42b2b097cc69600a0535d92e1e469d4f;hp=08a94c62c94ef6bb8667c73f636cb2af432f1fef;hpb=e7aef27c0011d3fd0b569ebdb9196a1e011eae5d;p=akkoma
diff --git a/lib/pleroma/list.ex b/lib/pleroma/list.ex
index 08a94c62c..fe5721c34 100644
--- a/lib/pleroma/list.ex
+++ b/lib/pleroma/list.ex
@@ -1,5 +1,5 @@
# Pleroma: A lightweight social networking server
-# Copyright © 2017-2019 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