User search: Make uri matches case insensitive.
authorlain <lain@soykaf.club>
Fri, 25 Sep 2020 06:56:58 +0000 (08:56 +0200)
committerlain <lain@soykaf.club>
Fri, 25 Sep 2020 06:56:58 +0000 (08:56 +0200)
priv/repo/migrations/20200925065249_make_user_ids_ci.exs [new file with mode: 0644]
test/user_search_test.exs

diff --git a/priv/repo/migrations/20200925065249_make_user_ids_ci.exs b/priv/repo/migrations/20200925065249_make_user_ids_ci.exs
new file mode 100644 (file)
index 0000000..b7305f1
--- /dev/null
@@ -0,0 +1,19 @@
+defmodule Pleroma.Repo.Migrations.MakeUserIdsCI do
+  use Ecto.Migration
+
+  def up do
+    alter table(:users) do
+      modify(:uri, :citext)
+    end
+
+    create(unique_index(:users, :uri))
+  end
+
+  def don do
+    drop(unique_index(:users, :uri))
+
+    alter table(:users) do
+      modify(:uri, :text)
+    end
+  end
+end
index cc14e97415547bb1bbffbb58c263473e712dbf89..b99a77b579842019e1e6e297559586800e4fa288 100644 (file)
@@ -41,7 +41,7 @@ defmodule Pleroma.UserSearchTest do
         insert(:user, %{
           nickname: "no_relation",
           ap_id: "https://lain.com/users/lain",
-          uri: "https://lain.com/@lain"
+          uri: "https://lain.com/@Lain"
         })
 
       _user = insert(:user, %{nickname: "com_user"})