diff options
author | Christopher Speller <crspeller@gmail.com> | 2015-07-08 11:50:10 -0400 |
---|---|---|
committer | Christopher Speller <crspeller@gmail.com> | 2015-07-20 17:45:23 -0400 |
commit | c6fb95912bb481791c1ca370a46a4da9c05d05ad (patch) | |
tree | bb33ff7b494b45c9d95c15f290d97914e911ce91 /web/react/utils/utils.jsx | |
parent | a1876cf6cc827743d8687a9113b727ef7190f452 (diff) | |
download | chat-c6fb95912bb481791c1ca370a46a4da9c05d05ad.tar.gz chat-c6fb95912bb481791c1ca370a46a4da9c05d05ad.tar.bz2 chat-c6fb95912bb481791c1ca370a46a4da9c05d05ad.zip |
Changing the way we mattermost handles URLs. team.domain.com becomes domain.com/team.
Renaming team.Name to team.DisplayName and team.Domain to team.Name.
So: team.Name -> url safe name. team.DisplayName -> nice name for users
Diffstat (limited to 'web/react/utils/utils.jsx')
-rw-r--r-- | web/react/utils/utils.jsx | 26 |
1 files changed, 7 insertions, 19 deletions
diff --git a/web/react/utils/utils.jsx b/web/react/utils/utils.jsx index 416ea5ae4..00580af6e 100644 --- a/web/react/utils/utils.jsx +++ b/web/react/utils/utils.jsx @@ -16,10 +16,10 @@ module.exports.isEmail = function(email) { }; module.exports.cleanUpUrlable = function(input) { - var cleaned = input.trim().replace(/-/g, ' ').replace(/[^\w\s]/gi, '').toLowerCase().replace(/\s/g, '-'); - cleaned = cleaned.replace(/^\-+/, ''); - cleaned = cleaned.replace(/\-+$/, ''); - return cleaned; + var cleaned = input.trim().replace(/-/g, ' ').replace(/[^\w\s]/gi, '').toLowerCase().replace(/\s/g, '-'); + cleaned = cleaned.replace(/^\-+/, ''); + cleaned = cleaned.replace(/\-+$/, ''); + return cleaned; }; @@ -114,7 +114,7 @@ module.exports.notifyMe = function(title, body, channel) { if (channel) { module.exports.switchChannel(channel); } else { - window.location.href = "/channels/town-square"; + window.location.href = "/"; } }; setTimeout(function(){ @@ -708,8 +708,8 @@ module.exports.switchChannel = function(channel, teammate_name) { id: channel.id }); - var domain = window.location.href.split('/channels')[0]; - history.replaceState('data', '', domain + '/channels/' + channel.name); + var teamURL = window.location.href.split('/channels')[0]; + history.replaceState('data', '', teamURL + '/channels/' + channel.name); if (channel.type === 'D' && teammate_name) { document.title = teammate_name + " " + document.title.substring(document.title.lastIndexOf("-")); @@ -784,18 +784,6 @@ Image.prototype.load = function(url, progressCallback) { Image.prototype.completedPercentage = 0; -module.exports.getHomeLink = function() { - if (config.HomeLink != "") { - return config.HomeLink; - } - var parts = window.location.host.split("."); - if (parts.length <= 1) { - return window.location.protocol + "//" + window.location.host; - } - parts[0] = "www"; - return window.location.protocol + "//" + parts.join("."); -} - module.exports.changeColor =function(col, amt) { var usePound = false; |