Extract host from ap_id, add index

This commit is contained in:
eal 2018-06-06 21:13:40 +03:00
parent 9075b6d25b
commit 29c9c8d93b
2 changed files with 9 additions and 1 deletions

View File

@ -445,7 +445,7 @@ defp restrict_blocked(query, %{"blocking_user" => %User{info: info}}) do
activity in query,
where: fragment("not (? = ANY(?))", activity.actor, ^blocks),
where: fragment("not (?->'to' \\?| ?)", activity.data, ^blocks),
where: fragment("not (? ~ ANY(?))", activity.actor, ^domain_blocks)
where: fragment("not (split_part(?, '/', 3) = ANY(?))", activity.actor, ^domain_blocks)
)
end

View File

@ -0,0 +1,8 @@
defmodule Pleroma.Repo.Migrations.CreateApidHostExtractionIndex do
use Ecto.Migration
@disable_ddl_transaction true
def change do
create index(:activities, ["(split_part(actor, '/', 3))"], concurrently: true, name: :activities_hosts)
end
end