summaryrefslogtreecommitdiffstats
path: root/webapp/utils/utils.jsx
diff options
context:
space:
mode:
authorHarrison Healey <harrisonmhealey@gmail.com>2016-08-02 16:37:09 -0400
committerGitHub <noreply@github.com>2016-08-02 16:37:09 -0400
commitc4a3118e9f885e92bb9b7d882898e9a51fc3be69 (patch)
tree7564e7aa04e7c656781b34375d6964d029755c38 /webapp/utils/utils.jsx
parente67bbcb0ae483cc86ae3a80ace36f1e6e663b589 (diff)
downloadchat-c4a3118e9f885e92bb9b7d882898e9a51fc3be69.tar.gz
chat-c4a3118e9f885e92bb9b7d882898e9a51fc3be69.tar.bz2
chat-c4a3118e9f885e92bb9b7d882898e9a51fc3be69.zip
PLT-3408 Add SiteURL to config.json (#3692)
* PLT-3408 Changed serverside code to get the service's URL from config.json * PLT-3408 Changed most clientside code to use the SiteURL config setting instead of window.location * PLT-3408 Changed default SiteURL to be autodetected
Diffstat (limited to 'webapp/utils/utils.jsx')
-rw-r--r--webapp/utils/utils.jsx55
1 files changed, 2 insertions, 53 deletions
diff --git a/webapp/utils/utils.jsx b/webapp/utils/utils.jsx
index c4cee3235..4b3c8518c 100644
--- a/webapp/utils/utils.jsx
+++ b/webapp/utils/utils.jsx
@@ -99,20 +99,6 @@ export function isSystemAdmin(roles) {
return false;
}
-export function getDomainWithOutSub() {
- var parts = window.location.host.split('.');
-
- if (parts.length === 1) {
- if (parts[0].indexOf('dockerhost') > -1) {
- return 'dockerhost:8065';
- }
-
- return 'localhost:8065';
- }
-
- return parts[1] + '.' + parts[2];
-}
-
export function getCookie(name) {
var value = '; ' + document.cookie;
var parts = value.split('; ' + name + '=');
@@ -171,18 +157,6 @@ export function ding() {
}
}
-export function getUrlParameter(sParam) {
- var sPageURL = window.location.search.substring(1);
- var sURLVariables = sPageURL.split('&');
- for (var i = 0; i < sURLVariables.length; i++) {
- var sParameterName = sURLVariables[i].split('=');
- if (sParameterName[0] === sParam) {
- return sParameterName[1];
- }
- }
- return null;
-}
-
export function getDateForUnixTicks(ticks) {
return new Date(ticks);
}
@@ -1015,18 +989,6 @@ export function displayUsernameForUser(user) {
return username;
}
-//IE10 does not set window.location.origin automatically so this must be called instead when using it
-export function getWindowLocationOrigin() {
- var windowLocationOrigin = window.location.origin;
- if (!windowLocationOrigin) {
- windowLocationOrigin = window.location.protocol + '//' + window.location.hostname;
- if (window.location.port) {
- windowLocationOrigin += ':' + window.location.port;
- }
- }
- return windowLocationOrigin;
-}
-
// Converts a file size in bytes into a human-readable string of the form '123MB'.
export function fileSizeToString(bytes) {
// it's unlikely that we'll have files bigger than this
@@ -1045,7 +1007,7 @@ export function fileSizeToString(bytes) {
// Converts a filename (like those attached to Post objects) to a url that can be used to retrieve attachments from the server.
export function getFileUrl(filename) {
- return getWindowLocationOrigin() + Client.getFilesRoute() + '/get' + filename;
+ return Client.getFilesRoute() + '/get' + filename;
}
// Gets the name of a file (including extension) from a given url or file path.
@@ -1151,20 +1113,7 @@ export function importSlack(file, success, error) {
Client.importSlack(formData, success, error);
}
-export function getTeamURLFromAddressBar() {
- return window.location.origin + '/' + window.location.pathname.split('/')[1];
-}
-
-export function getTeamNameFromUrl() {
- return window.location.pathname.split('/')[1];
-}
-
-export function getTeamURLNoOriginFromAddressBar() {
- return '/' + window.location.pathname.split('/')[1];
-}
-
-export function getShortenedTeamURL() {
- const teamURL = getTeamURLFromAddressBar();
+export function getShortenedTeamURL(teamURL = '') {
if (teamURL.length > 35) {
return teamURL.substring(0, 10) + '...' + teamURL.substring(teamURL.length - 12, teamURL.length) + '/';
}