[#1335] User: refactored :blocks field into :blocked_users relation.

Introduced UserBlock.
This commit is contained in:
Ivan Tashkinov 2019-11-10 16:30:21 +03:00
commit 3db988250b
20 changed files with 234 additions and 69 deletions

View file

@ -60,8 +60,10 @@ defmodule Pleroma.Notification do
end
defp exclude_blocked(query, user) do
blocked_ap_ids = User.blocked_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