Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F85829171
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Authored By
Unknown
Size
1 KB
Referenced Files
None
Subscribers
None
View Options
diff --git a/priv/repo/migrations/20190825233255_fill_recipient_users_in_activities.exs b/priv/repo/migrations/20190825233255_fill_recipient_users_in_activities.exs
new file mode 100644
index 000000000..351c66b01
--- /dev/null
+++ b/priv/repo/migrations/20190825233255_fill_recipient_users_in_activities.exs
@@ -0,0 +1,31 @@
+defmodule Pleroma.Repo.Migrations.FillRecipientUsersInActivities do
+ use Ecto.Migration
+
+ alias Pleroma.RepoStreamer
+ alias Pleroma.User
+
+ import Ecto.Query
+
+ def up do
+ # copy users without as:Public
+ execute("""
+ update activities set recipient_users = array_remove(recipients, 'https://www.w3.org/ns/activitystreams#Public');
+ """)
+
+ # strip followers collections
+ from(
+ u in User,
+ where: not(is_nil(u.follower_address))
+ )
+ |> RepoStreamer.chunk_stream(512)
+ |> Stream.each(fn chunk ->
+ chunk
+ |> Enum.each(fn %User{} = u ->
+ execute("update activities set recipient_users = array_remove(recipient_users, '#{u.follower_address}') where recipient_users && array['#{u.follower_address}'::varchar]")
+ end)
+ end)
+ |> Stream.run()
+ end
+
+ def down, do: :ok
+end
File Metadata
Details
Attached
Mime Type
text/x-diff
Expires
Sat, Oct 31, 4:09 PM (15 h, 18 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1801567
Default Alt Text
(1 KB)
Attached To
Mode
rPUBE pleroma-upstream
Attached
Detach File
Event Timeline