Add AP fixup task.
This commit is contained in:
parent
8895088029
commit
1555b7fab5
1 changed files with 20 additions and 0 deletions
20
lib/mix/tasks/fix_ap_users.ex
Normal file
20
lib/mix/tasks/fix_ap_users.ex
Normal file
|
@ -0,0 +1,20 @@
|
|||
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}")
|
||||
Pleroma.Web.ActivityPub.Transmogrifier.upgrade_user_from_ap_id(user.ap_id)
|
||||
end)
|
||||
end
|
||||
end
|
Loading…
Reference in a new issue