From 5fbd1e98601f2a52c0b72d9559dec7a41db7f84a Mon Sep 17 00:00:00 2001 From: Michael Leer Date: Mon, 14 Sep 2015 15:15:48 +0100 Subject: PLT-41 Removed lowercase from the error wording. Removed additional toLowerCase within validator. --- web/react/utils/utils.jsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'web/react/utils') diff --git a/web/react/utils/utils.jsx b/web/react/utils/utils.jsx index 71cd1d344..879f68689 100644 --- a/web/react/utils/utils.jsx +++ b/web/react/utils/utils.jsx @@ -828,11 +828,11 @@ export function isValidUsername(name) { } else if (name.length < 3 || name.length > 15) { error = 'Must be between 3 and 15 characters'; } else if (!(/^[a-z0-9\.\-\_]+$/).test(name)) { - error = "Must contain only lowercase letters, numbers, and the symbols '.', '-', and '_'."; + error = "Must contain only letters, numbers, and the symbols '.', '-', and '_'."; } else if (!(/[a-z]/).test(name.charAt(0))) { error = 'First character must be a letter.'; } else { - var lowerName = name.toLowerCase().trim(); + var lowerName = name; for (var i = 0; i < Constants.RESERVED_USERNAMES.length; i++) { if (lowerName === Constants.RESERVED_USERNAMES[i]) { -- cgit v1.2.3-1-g7c22 From 90ef55b4284e654ecae614b8d3b0c59bfba95b3b Mon Sep 17 00:00:00 2001 From: Michael Leer Date: Mon, 14 Sep 2015 16:10:31 +0100 Subject: replace lowerName with name --- web/react/utils/utils.jsx | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'web/react/utils') diff --git a/web/react/utils/utils.jsx b/web/react/utils/utils.jsx index 879f68689..54d05f484 100644 --- a/web/react/utils/utils.jsx +++ b/web/react/utils/utils.jsx @@ -832,10 +832,8 @@ export function isValidUsername(name) { } else if (!(/[a-z]/).test(name.charAt(0))) { error = 'First character must be a letter.'; } else { - var lowerName = name; - for (var i = 0; i < Constants.RESERVED_USERNAMES.length; i++) { - if (lowerName === Constants.RESERVED_USERNAMES[i]) { + if (name === Constants.RESERVED_USERNAMES[i]) { error = 'Cannot use a reserved word as a username.'; break; } -- cgit v1.2.3-1-g7c22 From 0ea0233c50dbccc498cb53481b9fdf18d027e5b2 Mon Sep 17 00:00:00 2001 From: Christopher Speller Date: Mon, 14 Sep 2015 13:56:58 -0400 Subject: New add channel modal using react-bootstrap. --- web/react/utils/utils.jsx | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'web/react/utils') diff --git a/web/react/utils/utils.jsx b/web/react/utils/utils.jsx index 71cd1d344..2fd6152c3 100644 --- a/web/react/utils/utils.jsx +++ b/web/react/utils/utils.jsx @@ -1127,3 +1127,14 @@ export function importSlack(file, success, error) { client.importSlack(formData, success, error); } + +export function getTeamURLFromAddressBar() { + return window.location.href.split('/channels')[0]; +} + +export function getShortenedTeamURL() { + const teamURL = getTeamURLFromAddressBar(); + if (teamURL.length > 24) { + return teamURL.substring(0, 10) + '...' + teamURL.substring(teamURL.length - 12, teamURL.length - 1) + '/'; + } +} -- cgit v1.2.3-1-g7c22