diff options
author | lain <lain@soykaf.club> | 2019-01-27 21:03:15 +0100 |
---|---|---|
committer | lain <lain@soykaf.club> | 2019-01-27 21:03:15 +0100 |
commit | 2e277dd4ad96ef6f7ce3267eb05d0b84668df772 (patch) | |
tree | 9ac9b8daef8251a98030ca8481c1e824aa135412 /lib | |
parent | aa8ddfdbe2303375e3f019faca30a620bfc58fc7 (diff) | |
download | pleroma-2e277dd4ad96ef6f7ce3267eb05d0b84668df772.tar.gz |
Fix objects.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/pleroma/spc_fixes/spc_fixes.ex | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/lib/pleroma/spc_fixes/spc_fixes.ex b/lib/pleroma/spc_fixes/spc_fixes.ex index 41cf56fdd..86bbb7f6f 100644 --- a/lib/pleroma/spc_fixes/spc_fixes.ex +++ b/lib/pleroma/spc_fixes/spc_fixes.ex @@ -5,6 +5,7 @@ alias Pleroma.Repo alias Pleroma.User alias Pleroma.Activity +alias Pleroma.Object import Ecto.Query defmodule Pleroma.SpcFixes do @@ -87,6 +88,26 @@ defmodule Pleroma.SpcFixes do ) Repo.update_all(query, []) + + # Fix objects + query = + from(a in Object, + where: fragment("?->>'actor' = ?", a.data, ^mapping[user.ap_id]), + update: [ + set: [ + data: + fragment( + "jsonb_set(jsonb_set(?, '{actor}', ?), '{to}', (?->'to')::jsonb || ?)", + a.data, + ^user.ap_id, + a.data, + ^[user.follower_address] + ) + ] + ] + ) + + Repo.update_all(query, []) end) end end |