Merge branch 'develop' into issue/1342

This commit is contained in:
Maksim Pechnikov 2019-12-08 21:25:26 +03:00
commit 95e6a2acd9
55 changed files with 1159 additions and 417 deletions

View file

@ -103,9 +103,13 @@ defmodule Pleroma.User.Search do
from(q in query, where: q.invisible == false)
end
defp filter_blocked_user(query, %User{blocks: blocks})
when length(blocks) > 0 do
from(q in query, where: not (q.ap_id in ^blocks))
defp filter_blocked_user(query, %User{} = blocker) do
query
|> join(:left, [u], b in Pleroma.UserRelationship,
as: :blocks,
on: b.relationship_type == ^:block and b.source_id == ^blocker.id and u.id == b.target_id
)
|> where([blocks: b], is_nil(b.target_id))
end
defp filter_blocked_user(query, _), do: query