diff options
author | eugenijm <eugenijm@protonmail.com> | 2020-05-18 18:46:04 +0300 |
---|---|---|
committer | eugenijm <eugenijm@protonmail.com> | 2020-06-14 18:27:11 +0300 |
commit | b15cfc3d365dcfa5f99159fe06e29de6f8aceb4f (patch) | |
tree | 156ff3c3c0fb6eb12064e536ae5a754048b48af4 /priv/repo/migrations | |
parent | 271ea5068f4e3b901cb3f682e132378246daf452 (diff) | |
download | pleroma-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.exs | 18 |
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 |