logo

pleroma

My custom branche(s) on git.pleroma.social/pleroma/pleroma git clone https://anongit.hacktivis.me/git/pleroma.git/

20200527163635_delete_notifications_from_invisible_users.exs (564B)


  1. # Pleroma: A lightweight social networking server
  2. # Copyright © 2017-2022 Pleroma Authors <https://pleroma.social/>
  3. # SPDX-License-Identifier: AGPL-3.0-only
  4. defmodule Pleroma.Repo.Migrations.DeleteNotificationsFromInvisibleUsers do
  5. use Ecto.Migration
  6. import Ecto.Query
  7. alias Pleroma.Repo
  8. def up do
  9. Pleroma.Notification
  10. |> join(:inner, [n], activity in assoc(n, :activity))
  11. |> where(
  12. [n, a],
  13. fragment("? in (SELECT ap_id FROM users WHERE invisible = true)", a.actor)
  14. )
  15. |> Repo.delete_all()
  16. end
  17. def down, do: :ok
  18. end