From: lain Date: Wed, 21 Feb 2018 21:59:00 +0000 (+0100) Subject: Add AP fixup task. X-Git-Url: https://git.squeep.com/?a=commitdiff_plain;h=1555b7fab56e404bc6fae775c5d91e705c9df3f5;p=akkoma Add AP fixup task. --- diff --git a/lib/mix/tasks/fix_ap_users.ex b/lib/mix/tasks/fix_ap_users.ex new file mode 100644 index 000000000..09a2c0424 --- /dev/null +++ b/lib/mix/tasks/fix_ap_users.ex @@ -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