Merge branch 'improve-move-notificaions-api' into 'develop'
authorrinpatch <rinpatch@sdf.org>
Sun, 8 Dec 2019 13:07:05 +0000 (13:07 +0000)
committerrinpatch <rinpatch@sdf.org>
Sun, 8 Dec 2019 13:07:05 +0000 (13:07 +0000)
Add `with_move` query param to the notifications API

See merge request pleroma/pleroma!2032

1  2 
lib/pleroma/notification.ex
lib/pleroma/web/mastodon_api/mastodon_api.ex
test/notification_test.exs
test/web/activity_pub/activity_pub_test.exs
test/web/mastodon_api/controllers/notification_controller_test.exs

index 43719b9620ee1c13e008a773251fc8d51f141181,6b6e1c2e1bb38d6206d3a4e85ee5d662f95c659d..71423ce5e89695175073e6d44d41bfaba56b5f88
@@@ -74,16 -54,15 +74,17 @@@ defmodule Pleroma.Notification d
          )
      )
      |> preload([n, a, o], activity: {a, object: o})
 -    |> exclude_muted(user, opts)
 -    |> exclude_blocked(user)
 +    |> exclude_notification_muted(user, exclude_notification_muted_opts)
 +    |> exclude_blocked(user, exclude_blocked_opts)
      |> exclude_visibility(opts)
+     |> exclude_move(opts)
    end
  
 -  defp exclude_blocked(query, user) do
 +  defp exclude_blocked(query, user, opts) do
 +    blocked_ap_ids = opts[:blocked_users_ap_ids] || User.blocked_users_ap_ids(user)
 +
      query
 -    |> where([n, a], a.actor not in ^user.blocks)
 +    |> where([n, a], a.actor not in ^blocked_ap_ids)
      |> where(
        [n, a],
        fragment("substring(? from '.*://([^/]*)')", a.actor) not in ^user.domain_blocks
Simple merge