switch mix task to fetch
This commit is contained in:
parent
6252b045c1
commit
12274f8fb7
1 changed files with 10 additions and 16 deletions
|
@ -258,32 +258,26 @@ def run(["untag", nickname | tags]) do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def run(["broadcast_public_keys" | _rest]) do
|
def run(["refetch_public_keys" | _rest]) do
|
||||||
start_pleroma()
|
start_pleroma()
|
||||||
|
|
||||||
Pleroma.User.Query.build(%{
|
Pleroma.User.Query.build(%{
|
||||||
local: true,
|
external: true,
|
||||||
is_active: true
|
is_active: true
|
||||||
})
|
})
|
||||||
|> Pleroma.Repo.chunk_stream(50, :batches)
|
|> Pleroma.Repo.chunk_stream(50, :batches)
|
||||||
|> Stream.each(fn users ->
|
|> Stream.each(fn users ->
|
||||||
users
|
users
|
||||||
|> Enum.each(fn user ->
|
|> Enum.each(fn user ->
|
||||||
IO.puts("Broadcasting: #{user.ap_id}")
|
IO.puts("Re-Resolving: #{user.ap_id}")
|
||||||
changeset = User.update_changeset(user, %{keys: user.keys})
|
|
||||||
{:ok, unpersisted_user} = Ecto.Changeset.apply_action(changeset, :update)
|
|
||||||
|
|
||||||
updated_object =
|
with {:ok, user} <- Pleroma.User.fetch_by_ap_id(user.ap_id),
|
||||||
Pleroma.Web.ActivityPub.UserView.render("user.json", user: unpersisted_user)
|
changeset <- Pleroma.User.update_changeset(user),
|
||||||
|> Map.delete("@context")
|
{:ok, _user} <- Pleroma.User.update_and_set_cache(changeset) do
|
||||||
|
:ok
|
||||||
{:ok, update_data, []} = Builder.update(user, updated_object)
|
else
|
||||||
|
error -> IO.puts("Could not resolve: #{user.ap_id}, #{inspect(error)}")
|
||||||
{:ok, _update, _} =
|
end
|
||||||
Pipeline.common_pipeline(update_data,
|
|
||||||
local: true,
|
|
||||||
user_update_changeset: changeset
|
|
||||||
)
|
|
||||||
end)
|
end)
|
||||||
end)
|
end)
|
||||||
|> Stream.run()
|
|> Stream.run()
|
||||||
|
|
Loading…
Reference in a new issue