projects
/
akkoma
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge branch 'fix-streaming' into 'develop'
[akkoma]
/
lib
/
mix
/
tasks
/
pleroma
/
user.ex
diff --git
a/lib/mix/tasks/pleroma/user.ex
b/lib/mix/tasks/pleroma/user.ex
index da140ac86d895ca18653f39f505408346b58b8b8..3635c02bc4d21aaf0b29c5f25434e3d83e624ebf 100644
(file)
--- a/
lib/mix/tasks/pleroma/user.ex
+++ b/
lib/mix/tasks/pleroma/user.ex
@@
-144,28
+144,18
@@
defmodule Mix.Tasks.Pleroma.User do
end
end
end
end
- def run(["
unsubscrib
e", nickname]) do
+ def run(["
deactivat
e", nickname]) do
start_pleroma()
with %User{} = user <- User.get_cached_by_nickname(nickname) do
shell_info("Deactivating #{user.nickname}")
User.deactivate(user)
start_pleroma()
with %User{} = user <- User.get_cached_by_nickname(nickname) do
shell_info("Deactivating #{user.nickname}")
User.deactivate(user)
-
- user
- |> User.get_friends()
- |> Enum.each(fn friend ->
- user = User.get_cached_by_id(user.id)
-
- shell_info("Unsubscribing #{friend.nickname} from #{user.nickname}")
- User.unfollow(user, friend)
- end)
-
:timer.sleep(500)
user = User.get_cached_by_id(user.id)
:timer.sleep(500)
user = User.get_cached_by_id(user.id)
- if Enum.empty?(
User.get_friends(user
)) do
- shell_info("Successfully unsubscribed all followers from #{user.nickname}")
+ if Enum.empty?(
Enum.filter(User.get_friends(user), & &1.local
)) do
+ shell_info("Successfully unsubscribed all
local
followers from #{user.nickname}")
end
else
_ ->
end
else
_ ->
@@
-173,7
+163,7
@@
defmodule Mix.Tasks.Pleroma.User do
end
end
end
end
- def run(["
unsubscrib
e_all_from_instance", instance]) do
+ def run(["
deactivat
e_all_from_instance", instance]) do
start_pleroma()
Pleroma.User.Query.build(%{nickname: "@#{instance}"})
start_pleroma()
Pleroma.User.Query.build(%{nickname: "@#{instance}"})
@@
-181,7
+171,7
@@
defmodule Mix.Tasks.Pleroma.User do
|> Stream.each(fn users ->
users
|> Enum.each(fn user ->
|> Stream.each(fn users ->
users
|> Enum.each(fn user ->
- run(["
unsubscrib
e", user.nickname])
+ run(["
deactivat
e", user.nickname])
end)
end)
|> Stream.run()
end)
end)
|> Stream.run()