Simplify DM query.

Should also use indexes better.
This commit is contained in:
lain 2018-05-26 16:25:32 +02:00
commit 841ee8e3e4
2 changed files with 37 additions and 14 deletions

View file

@ -313,9 +313,11 @@ defmodule Pleroma.Web.ActivityPub.ActivityPub do
on: sender.ap_id == activity.actor,
# Are non-direct statuses with no to/cc possible?
where:
fragment("not coalesce(data->'to' \\? ?, false)", ^public) and
fragment("not coalesce(data->'cc' \\? ?, false)", ^public) and
fragment("not coalesce(data->'to' \\? ?, false)", sender.follower_address)
fragment(
"not (? && ?)",
[^public, sender.follower_address],
activity.recipients
)
)
end