summaryrefslogtreecommitdiffstats
path: root/webapp/stores
diff options
context:
space:
mode:
authorHarrison Healey <harrisonmhealey@gmail.com>2016-08-09 09:53:22 -0400
committerenahum <nahumhbl@gmail.com>2016-08-09 08:53:22 -0500
commit0afa28de0953ed528486a7d7ad6000f344624710 (patch)
treea31d1668aab355784547d1bc93ab3d8801ed2dd7 /webapp/stores
parent09d98b486e8245ae84a452331e36e2978a6d01ab (diff)
downloadchat-0afa28de0953ed528486a7d7ad6000f344624710.tar.gz
chat-0afa28de0953ed528486a7d7ad6000f344624710.tar.bz2
chat-0afa28de0953ed528486a7d7ad6000f344624710.zip
Changed autodetection of SiteURL (#3764)
* Changed autoconfiguration of SiteURL to be done on every request * Added SiteURL to system console
Diffstat (limited to 'webapp/stores')
-rw-r--r--webapp/stores/team_store.jsx28
1 files changed, 13 insertions, 15 deletions
diff --git a/webapp/stores/team_store.jsx b/webapp/stores/team_store.jsx
index a482fa3a1..90cb66bb2 100644
--- a/webapp/stores/team_store.jsx
+++ b/webapp/stores/team_store.jsx
@@ -60,13 +60,7 @@ class TeamStoreClass extends EventEmitter {
}
getCurrentId() {
- var team = this.get(this.currentTeamId);
-
- if (team) {
- return team.id;
- }
-
- return null;
+ return this.currentTeamId;
}
getCurrent() {
@@ -80,10 +74,7 @@ class TeamStoreClass extends EventEmitter {
}
getCurrentTeamUrl() {
- if (this.getCurrent()) {
- return window.mm_config.SiteURL + '/' + this.getCurrent().name;
- }
- return '';
+ return this.getTeamUrl(this.currentTeamId);
}
getCurrentTeamRelativeUrl() {
@@ -97,7 +88,10 @@ class TeamStoreClass extends EventEmitter {
const current = this.getCurrent();
if (current) {
- return window.mm_config.SiteURL + '/signup_user_complete/?id=' + current.invite_id;
+ // can't call Utils.getSiteURL here because that introduces a circular dependency
+ const origin = window.mm_config.SiteURL || window.location.origin;
+
+ return origin + '/signup_user_complete/?id=' + current.invite_id;
}
return '';
@@ -105,11 +99,15 @@ class TeamStoreClass extends EventEmitter {
getTeamUrl(id) {
const team = this.get(id);
- if (team) {
- return window.mm_config.SiteURL + '/' + team.name;
+
+ if (!team) {
+ return '';
}
- return '';
+ // can't call Utils.getSiteURL here because that introduces a circular dependency
+ const origin = window.mm_config.SiteURL || window.location.origin;
+
+ return origin + '/' + team.name;
}
saveTeam(team) {