Commit 47684c2a authored by lain's avatar lain
Browse files

Make email and nickname case insensitive.

parent 9d97be44
defmodule Pleroma.Repo.Migrations.CaseInsensivtivity do
use Ecto.Migration
def up do
execute ("create extension if not exists citext")
alter table(:users) do
modify :email, :citext
modify :nickname, :citext
end
end
def down do
alter table(:users) do
modify :email, :string
modify :nickname, :string
end
execute ("drop extension if exists citext")
end
end
......@@ -114,6 +114,13 @@ defmodule Pleroma.UserTest do
assert user == fetched_user
end
test "gets an existing user, case insensitive" do
user = insert(:user, nickname: "nick")
fetched_user = User.get_or_fetch_by_nickname("NICK")
assert user == fetched_user
end
test "fetches an external user via ostatus if no user exists" do
fetched_user = User.get_or_fetch_by_nickname("shp@social.heldscal.la")
assert fetched_user.nickname == "shp@social.heldscal.la"
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment