diff options
author | eal <eal@waifu.club> | 2018-06-06 21:13:40 +0300 |
---|---|---|
committer | eal <eal@waifu.club> | 2018-06-06 21:13:40 +0300 |
commit | 29c9c8d93b263e57915158d09761bc6586826798 (patch) | |
tree | 64702d97dd8829c4b16d71a70dcf86b3d3e52f52 | |
parent | 9075b6d25b4b136bb8d8ae888bd52996a9f302e2 (diff) | |
download | pleroma-29c9c8d93b263e57915158d09761bc6586826798.tar.gz |
Extract host from ap_id, add index
-rw-r--r-- | lib/pleroma/web/activity_pub/activity_pub.ex | 2 | ||||
-rw-r--r-- | priv/repo/migrations/20180606173637_create_apid_host_extraction_index.exs | 8 |
2 files changed, 9 insertions, 1 deletions
diff --git a/lib/pleroma/web/activity_pub/activity_pub.ex b/lib/pleroma/web/activity_pub/activity_pub.ex index 5c61920e5..a5e42d9d0 100644 --- a/lib/pleroma/web/activity_pub/activity_pub.ex +++ b/lib/pleroma/web/activity_pub/activity_pub.ex @@ -445,7 +445,7 @@ defmodule Pleroma.Web.ActivityPub.ActivityPub 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 diff --git a/priv/repo/migrations/20180606173637_create_apid_host_extraction_index.exs b/priv/repo/migrations/20180606173637_create_apid_host_extraction_index.exs new file mode 100644 index 000000000..9831a1b82 --- /dev/null +++ b/priv/repo/migrations/20180606173637_create_apid_host_extraction_index.exs @@ -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 |