akkoma/lib/mix/tasks/fix_ap_users.ex

21 lines
501 B
Elixir
Raw Normal View History

2018-02-21 21:59:00 +00:00
defmodule Mix.Tasks.FixApUsers do
use Mix.Task
import Mix.Ecto
import Ecto.Query
alias Pleroma.{Repo, User}
@shortdoc "Grab all ap users again"
def run([]) do
Mix.Task.run("app.start")
q = from u in User,
where: fragment("? @> ?", u.info, ^%{"ap_enabled" => true})
users = Repo.all(q)
Enum.each(users, fn(user) ->
IO.puts("Fetching #{user.nickname}")
2018-02-24 09:51:15 +00:00
Pleroma.Web.ActivityPub.Transmogrifier.upgrade_user_from_ap_id(user.ap_id, false)
2018-02-21 21:59:00 +00:00
end)
end
end