When we send emails, and eventually for the social site, the practice of encoding query strings is annoying. Mostly, it's visually unappealing, and it obscures the readability (and type-ability) of URLs and usernames.
My proposal is this:
Create a new DB column, called "slug"
Store a slug based on the username
the username parameter in a URL can be a slug or username.
In most cases these are the same
Add a unique index on the slug column
Creating slugs:
pick a set of "safe" characters for usernames
replace unsafe characters with a -.
If existing usernames would lead to conflicting slugs, we will "hand-edit" them using _ as the separator for the second slug, and in the few cases where there's more than 2 conflicts, I'll get creative, I guess. (But it's a tiny number of users.)
Lapis provide's a slugify method, but because it removes duplicate -, it leads to more conflicts, and it seems to filter out too many characters.
The lapis slugify method seems prone to returning an empty string in some cases, which seems wrong.
The username slug is also important for discourse which turns spaces into _. Discourse, annoyingly, normalizes unicode characters. Though I'd like not to do that.
When we send emails, and eventually for the social site, the practice of encoding query strings is annoying. Mostly, it's visually unappealing, and it obscures the readability (and type-ability) of URLs and usernames.
My proposal is this:
username
parameter in a URL can be a slug or username.Creating slugs:
pick a set of "safe" characters for usernames
replace unsafe characters with a
-
.If existing usernames would lead to conflicting slugs, we will "hand-edit" them using
_
as the separator for the second slug, and in the few cases where there's more than 2 conflicts, I'll get creative, I guess. (But it's a tiny number of users.)Lapis provide's a slugify method, but because it removes duplicate
-
, it leads to more conflicts, and it seems to filter out too many characters.The lapis slugify method seems prone to returning an empty string in some cases, which seems wrong.