diff --git a/lib/pleroma/user.ex b/lib/pleroma/user.ex index e92b85f52..0594afb38 100644 --- a/lib/pleroma/user.ex +++ b/lib/pleroma/user.ex @@ -265,7 +265,7 @@ def get_or_fetch_by_nickname(nickname) do def get_followers(%User{id: id, follower_address: follower_address}) do q = from u in User, - where: ^follower_address in u.following, + where: fragment("? <@ ?", ^[follower_address], u.following), where: u.id != ^id {:ok, Repo.all(q)} diff --git a/priv/repo/migrations/20180325172351_add_follower_address_index_to_users.exs b/priv/repo/migrations/20180325172351_add_follower_address_index_to_users.exs index dbf9599b0..234d33735 100644 --- a/priv/repo/migrations/20180325172351_add_follower_address_index_to_users.exs +++ b/priv/repo/migrations/20180325172351_add_follower_address_index_to_users.exs @@ -4,5 +4,6 @@ defmodule Pleroma.Repo.Migrations.AddFollowerAddressIndexToUsers do @disable_ddl_transaction true def change do create index(:users, [:follower_address], concurrently: true) + create index(:users, [:following], concurrently: true, using: :gin) end end