diff options
| author | Egor Kislitsyn <egor@kislitsyn.com> | 2019-10-11 02:35:32 +0700 | 
|---|---|---|
| committer | Egor Kislitsyn <egor@kislitsyn.com> | 2019-10-11 02:35:32 +0700 | 
| commit | 059005ff829c0313c62ddf5fbcd95f8892920228 (patch) | |
| tree | 9c33d41fc3efe721f477aef7daa37b05ba812964 /lib/mix/tasks | |
| parent | 2c7ff32e5b95926af9b6573a6dc6ea96e3ba7dd5 (diff) | |
| download | pleroma-059005ff829c0313c62ddf5fbcd95f8892920228.tar.gz pleroma-059005ff829c0313c62ddf5fbcd95f8892920228.zip | |
Replace `user.following` with Pleroma.FollowingRelationship
Diffstat (limited to 'lib/mix/tasks')
| -rw-r--r-- | lib/mix/tasks/pleroma/database.ex | 6 | ||||
| -rw-r--r-- | lib/mix/tasks/pleroma/relay.ex | 5 | ||||
| -rw-r--r-- | lib/mix/tasks/pleroma/user.ex | 2 | 
3 files changed, 7 insertions, 6 deletions
| diff --git a/lib/mix/tasks/pleroma/database.ex b/lib/mix/tasks/pleroma/database.ex index cfd9eeada..72b706e1a 100644 --- a/lib/mix/tasks/pleroma/database.ex +++ b/lib/mix/tasks/pleroma/database.ex @@ -52,9 +52,9 @@ defmodule Mix.Tasks.Pleroma.Database do    def run(["update_users_following_followers_counts"]) do      start_pleroma() -    users = Repo.all(User) -    Enum.each(users, &User.remove_duplicated_following/1) -    Enum.each(users, &User.update_follower_count/1) +    User +    |> Repo.all() +    |> Enum.each(&User.update_follower_count/1)    end    def run(["prune_objects" | args]) do diff --git a/lib/mix/tasks/pleroma/relay.ex b/lib/mix/tasks/pleroma/relay.ex index d7a7b599f..eafddada6 100644 --- a/lib/mix/tasks/pleroma/relay.ex +++ b/lib/mix/tasks/pleroma/relay.ex @@ -36,8 +36,9 @@ defmodule Mix.Tasks.Pleroma.Relay do    def run(["list"]) do      start_pleroma() -    with %User{following: following} = _user <- Relay.get_actor() do -      following +    with %User{} = user <- Relay.get_actor() do +      user +      |> User.following()        |> Enum.map(fn entry -> URI.parse(entry).host end)        |> Enum.uniq()        |> Enum.each(&shell_info(&1)) diff --git a/lib/mix/tasks/pleroma/user.ex b/lib/mix/tasks/pleroma/user.ex index 134b5bccc..8866afdf6 100644 --- a/lib/mix/tasks/pleroma/user.ex +++ b/lib/mix/tasks/pleroma/user.ex @@ -162,7 +162,7 @@ defmodule Mix.Tasks.Pleroma.User do        user = User.get_cached_by_id(user.id) -      if Enum.empty?(user.following) do +      if Enum.empty?(User.get_friends(user)) do          shell_info("Successfully unsubscribed all followers from #{user.nickname}")        end      else | 
