From 1555b7fab56e404bc6fae775c5d91e705c9df3f5 Mon Sep 17 00:00:00 2001 From: lain Date: Wed, 21 Feb 2018 22:59:00 +0100 Subject: [PATCH] Add AP fixup task. --- lib/mix/tasks/fix_ap_users.ex | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 lib/mix/tasks/fix_ap_users.ex 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