Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Pleroma
pleroma
Commits
47684c2a
Commit
47684c2a
authored
May 22, 2017
by
lain
Browse files
Make email and nickname case insensitive.
parent
9d97be44
Changes
2
Hide whitespace changes
Inline
Side-by-side
priv/repo/migrations/20170522160642_case_insensivtivity.exs
0 → 100644
View file @
47684c2a
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
test/user_test.exs
View file @
47684c2a
...
...
@@ -114,6 +114,13 @@ test "gets an existing user" 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"
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment