aboutsummaryrefslogtreecommitdiff
path: root/priv/repo/migrations
diff options
context:
space:
mode:
authoreugenijm <eugenijm@protonmail.com>2020-05-18 18:46:04 +0300
committereugenijm <eugenijm@protonmail.com>2020-06-14 18:27:11 +0300
commitb15cfc3d365dcfa5f99159fe06e29de6f8aceb4f (patch)
tree156ff3c3c0fb6eb12064e536ae5a754048b48af4 /priv/repo/migrations
parent271ea5068f4e3b901cb3f682e132378246daf452 (diff)
downloadpleroma-b15cfc3d365dcfa5f99159fe06e29de6f8aceb4f.tar.gz
Mastodon API: ensure the notification endpoint doesn't return less than the requested amount of records unless it's the last page
Diffstat (limited to 'priv/repo/migrations')
-rw-r--r--priv/repo/migrations/20200527163635_delete_notifications_from_invisible_users.exs18
1 files changed, 18 insertions, 0 deletions
diff --git a/priv/repo/migrations/20200527163635_delete_notifications_from_invisible_users.exs b/priv/repo/migrations/20200527163635_delete_notifications_from_invisible_users.exs
new file mode 100644
index 000000000..9e95a8111
--- /dev/null
+++ b/priv/repo/migrations/20200527163635_delete_notifications_from_invisible_users.exs
@@ -0,0 +1,18 @@
+defmodule Pleroma.Repo.Migrations.DeleteNotificationsFromInvisibleUsers do
+ use Ecto.Migration
+
+ import Ecto.Query
+ alias Pleroma.Repo
+
+ def up do
+ Pleroma.Notification
+ |> join(:inner, [n], activity in assoc(n, :activity))
+ |> where(
+ [n, a],
+ fragment("? in (SELECT ap_id FROM users WHERE invisible = true)", a.actor)
+ )
+ |> Repo.delete_all()
+ end
+
+ def down, do: :ok
+end