diff options
author | Fatih Acet <acetfatih@gmail.com> | 2016-10-13 10:36:47 +0000 |
---|---|---|
committer | Fatih Acet <acetfatih@gmail.com> | 2016-10-13 10:36:47 +0000 |
commit | 2208a878bc7704698d9a2dc19c9a161a139b5f35 (patch) | |
tree | 0bc9e2358d4bdc490c73ada9e0bfbc462d48af89 /app/assets | |
parent | a053430e94e21bbf81524304f9b52a106f654b54 (diff) | |
parent | f19766a3c2223b05e1f6de1746a44e7173387988 (diff) | |
download | gitlab-ce-2208a878bc7704698d9a2dc19c9a161a139b5f35.tar.gz |
Merge branch 'trim-new-user' into 'master'
Ensure that whitespace doesn't cause adding members to fail
I recently had to debug an issue where adding users wasn't working. It turned out that I was hitting "space" to confirm a `select2` dialog, and the server would throw out the whole email address because it was invalid. It looked as though GitLab was entirely ignoring my add-member request.
Here's a fun gif:
![out](/uploads/5c306addb764067bca54add3b7a53c6c/out.gif)
Ideally, there should also be validation client-side, so that the server doesn't need to silently fail, and the user will know what's going wrong. I'll look into creating an issue for that.
Additionally, GitLab already seems to trim email addresses, sometimes? If you add _two_ address, with spaces, then the `value` of the `user_ids` DOM element will have the first `n-1` addresses without spaces. Weird.
**TL;DR: Now spaces are always trimmed from new-member email addresses.**
See merge request !3443
Diffstat (limited to 'app/assets')
-rw-r--r-- | app/assets/javascripts/users_select.js | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/app/assets/javascripts/users_select.js b/app/assets/javascripts/users_select.js index bcabda3ceb2..d966277a8b2 100644 --- a/app/assets/javascripts/users_select.js +++ b/app/assets/javascripts/users_select.js @@ -261,10 +261,11 @@ } } if (showEmailUser && data.results.length === 0 && query.term.match(/^[^@]+@[^@]+$/)) { + var trimmed = query.term.trim(); emailUser = { name: "Invite \"" + query.term + "\"", - username: query.term, - id: query.term + username: trimmed, + id: trimmed }; data.results.unshift(emailUser); } |