From 1e0f3f8514a42b088ed68ece5f9e339ad829e242 Mon Sep 17 00:00:00 2001 From: lain Date: Fri, 25 Sep 2020 08:56:58 +0200 Subject: [PATCH] User search: Make uri matches case insensitive. --- .../20200925065249_make_user_ids_ci.exs | 19 +++++++++++++++++++ test/user_search_test.exs | 2 +- 2 files changed, 20 insertions(+), 1 deletion(-) create mode 100644 priv/repo/migrations/20200925065249_make_user_ids_ci.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 index 000000000..b7305f137 --- /dev/null +++ b/priv/repo/migrations/20200925065249_make_user_ids_ci.exs @@ -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 diff --git a/test/user_search_test.exs b/test/user_search_test.exs index cc14e9741..b99a77b57 100644 --- a/test/user_search_test.exs +++ b/test/user_search_test.exs @@ -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"}) -- 2.45.2