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
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
e67bbcb0ae
Коммит
c4a3118e9f
@@ -4,6 +4,7 @@
|
||||
import ReactDOM from 'react-dom';
|
||||
import Constants from 'utils/constants.jsx';
|
||||
import {Modal, Tooltip, OverlayTrigger} from 'react-bootstrap';
|
||||
import TeamStore from 'stores/team_store.jsx';
|
||||
import * as Utils from 'utils/utils.jsx';
|
||||
|
||||
import {FormattedMessage} from 'react-intl';
|
||||
@@ -130,8 +131,8 @@ export default class ChangeUrlModal extends React.Component {
|
||||
serverError = <div className='form-group has-error'><p className='input__help error'>{this.props.serverError}</p></div>;
|
||||
}
|
||||
|
||||
const fullTeamUrl = Utils.getTeamURLFromAddressBar();
|
||||
const teamURL = Utils.getShortenedTeamURL();
|
||||
const fullTeamUrl = TeamStore.getCurrentTeamUrl();
|
||||
const teamURL = Utils.getShortenedTeamURL(TeamStore.getCurrentTeamUrl());
|
||||
const urlTooltip = (
|
||||
<Tooltip id='urlTooltip'>{fullTeamUrl}</Tooltip>
|
||||
);
|
||||
|
||||
@@ -123,7 +123,7 @@ export default class ChannelHeader extends React.Component {
|
||||
});
|
||||
|
||||
const townsquare = ChannelStore.getByName('town-square');
|
||||
browserHistory.push(Utils.getTeamURLNoOriginFromAddressBar() + '/channels/' + townsquare.name);
|
||||
browserHistory.push(TeamStore.getCurrentTeamRelativeUrl() + '/channels/' + townsquare.name);
|
||||
},
|
||||
(err) => {
|
||||
AsyncClient.dispatchError(err, 'handleLeave');
|
||||
|
||||
@@ -5,6 +5,7 @@ import * as Utils from 'utils/utils.jsx';
|
||||
|
||||
import {FormattedMessage} from 'react-intl';
|
||||
import {Modal} from 'react-bootstrap';
|
||||
import TeamStore from 'stores/team_store.jsx';
|
||||
import * as TextFormatting from 'utils/text_formatting.jsx';
|
||||
|
||||
import React from 'react';
|
||||
@@ -44,7 +45,7 @@ export default class ChannelInfoModal extends React.Component {
|
||||
channelIcon = (<span className='fa fa-lock'/>);
|
||||
}
|
||||
|
||||
const channelURL = Utils.getTeamURLFromAddressBar() + '/channels/' + channel.name;
|
||||
const channelURL = TeamStore.getCurrentTeamUrl() + '/channels/' + channel.name;
|
||||
|
||||
let channelPurpose = null;
|
||||
if (channel.purpose) {
|
||||
|
||||
@@ -105,7 +105,7 @@ export default class TeamUrl extends React.Component {
|
||||
nameDivClass += ' has-error';
|
||||
}
|
||||
|
||||
const title = `${Utils.getWindowLocationOrigin()}/`;
|
||||
const title = `${window.mm_config.SiteURL}/`;
|
||||
const urlTooltip = (
|
||||
<Tooltip id='urlTooltip'>{title}</Tooltip>
|
||||
);
|
||||
|
||||
@@ -102,7 +102,7 @@ class FileAttachment extends React.Component {
|
||||
getFileInfoFromName(name) {
|
||||
var fileInfo = utils.splitFileLocation(name);
|
||||
|
||||
fileInfo.path = utils.getWindowLocationOrigin() + Client.getFilesRoute() + '/get' + fileInfo.path;
|
||||
fileInfo.path = Client.getFilesRoute() + '/get' + fileInfo.path;
|
||||
|
||||
return fileInfo;
|
||||
}
|
||||
|
||||
@@ -97,7 +97,7 @@ export default class InstalledIncomingWebhook extends React.Component {
|
||||
id='installed_integrations.url'
|
||||
defaultMessage='URL: {url}'
|
||||
values={{
|
||||
url: Utils.getWindowLocationOrigin() + '/hooks/' + incomingWebhook.id
|
||||
url: window.mm_config.SiteURL + '/hooks/' + incomingWebhook.id
|
||||
}}
|
||||
/>
|
||||
</span>
|
||||
|
||||
@@ -277,7 +277,7 @@ export default class LoginController extends React.Component {
|
||||
}
|
||||
|
||||
createLoginOptions() {
|
||||
const extraParam = Utils.getUrlParameter('extra');
|
||||
const extraParam = this.props.location.query.extra;
|
||||
let extraBox = '';
|
||||
if (extraParam) {
|
||||
if (extraParam === Constants.SIGNIN_CHANGE) {
|
||||
|
||||
@@ -74,7 +74,7 @@ export default class MoreChannels extends React.Component {
|
||||
channel,
|
||||
() => {
|
||||
$(ReactDOM.findDOMNode(this.refs.modal)).modal('hide');
|
||||
browserHistory.push(Utils.getTeamURLNoOriginFromAddressBar() + '/channels/' + channel.name);
|
||||
browserHistory.push(TeamStore.getCurrentTeamRelativeUrl() + '/channels/' + channel.name);
|
||||
this.setState({joiningChannel: ''});
|
||||
},
|
||||
(err) => {
|
||||
|
||||
@@ -87,7 +87,7 @@ export default class MoreDirectChannels extends React.Component {
|
||||
Utils.openDirectChannelToUser(
|
||||
teammate,
|
||||
(channel) => {
|
||||
browserHistory.push(Utils.getTeamURLNoOriginFromAddressBar() + '/channels/' + channel.name);
|
||||
browserHistory.push(TeamStore.getCurrentTeamUrl() + '/channels/' + channel.name);
|
||||
this.setState({loadingDMChannel: -1});
|
||||
this.handleHide();
|
||||
},
|
||||
|
||||
@@ -88,7 +88,7 @@ export default class NavbarDropdown extends React.Component {
|
||||
|
||||
return (
|
||||
<li>
|
||||
<Link to={'/' + Utils.getTeamNameFromUrl() + '/emoji'}>
|
||||
<Link to={'/' + this.props.teamName + '/emoji'}>
|
||||
<FormattedMessage
|
||||
id='navbar_dropdown.emoji'
|
||||
defaultMessage='Custom Emoji'
|
||||
@@ -207,7 +207,7 @@ export default class NavbarDropdown extends React.Component {
|
||||
if (integrationsEnabled && (isAdmin || window.mm_config.EnableOnlyAdminIntegrations !== 'true')) {
|
||||
integrationsLink = (
|
||||
<li>
|
||||
<Link to={'/' + Utils.getTeamNameFromUrl() + '/integrations'}>
|
||||
<Link to={'/' + this.props.teamName + '/integrations'}>
|
||||
<FormattedMessage
|
||||
id='navbar_dropdown.integrations'
|
||||
defaultMessage='Integrations'
|
||||
|
||||
@@ -73,7 +73,7 @@ export default class NeedsTeam extends React.Component {
|
||||
// Go to tutorial if we are first arriving
|
||||
const tutorialStep = PreferenceStore.getInt(Preferences.TUTORIAL_STEP, UserStore.getCurrentId(), 999);
|
||||
if (tutorialStep <= TutorialSteps.INTRO_SCREENS) {
|
||||
browserHistory.push(Utils.getTeamURLNoOriginFromAddressBar() + '/tutorial');
|
||||
browserHistory.push(TeamStore.getCurrentTeamRelativeUrl() + '/tutorial');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
|
||||
import * as Utils from 'utils/utils.jsx';
|
||||
import Client from 'client/web_client.jsx';
|
||||
import TeamStore from 'stores/team_store.jsx';
|
||||
import UserStore from 'stores/user_store.jsx';
|
||||
|
||||
import NewChannelModal from './new_channel_modal.jsx';
|
||||
@@ -117,7 +118,7 @@ class NewChannelFlow extends React.Component {
|
||||
});
|
||||
|
||||
this.props.onModalDismissed();
|
||||
browserHistory.push(Utils.getTeamURLNoOriginFromAddressBar() + '/channels/' + data2.channel.name);
|
||||
browserHistory.push(TeamStore.getCurrentTeamRelativeUrl() + '/channels/' + data2.channel.name);
|
||||
}
|
||||
);
|
||||
},
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
|
||||
import $ from 'jquery';
|
||||
|
||||
import TeamStore from 'stores/team_store.jsx';
|
||||
import UserStore from 'stores/user_store.jsx';
|
||||
import {Popover, Overlay} from 'react-bootstrap';
|
||||
import * as Utils from 'utils/utils.jsx';
|
||||
@@ -36,7 +37,7 @@ export default class PopoverListMembers extends React.Component {
|
||||
Utils.openDirectChannelToUser(
|
||||
teammate,
|
||||
(channel, channelAlreadyExisted) => {
|
||||
browserHistory.push(Utils.getTeamURLNoOriginFromAddressBar() + '/channels/' + channel.name);
|
||||
browserHistory.push(TeamStore.getCurrentTeamRelativeUrl() + '/channels/' + channel.name);
|
||||
if (channelAlreadyExisted) {
|
||||
this.closePopover();
|
||||
}
|
||||
|
||||
@@ -4,10 +4,10 @@
|
||||
import $ from 'jquery';
|
||||
import ReactDOM from 'react-dom';
|
||||
import ChannelStore from 'stores/channel_store.jsx';
|
||||
import TeamStore from 'stores/team_store.jsx';
|
||||
import UserStore from 'stores/user_store.jsx';
|
||||
import BrowserStore from 'stores/browser_store.jsx';
|
||||
|
||||
import * as Utils from 'utils/utils.jsx';
|
||||
import {FormattedMessage} from 'react-intl';
|
||||
import {browserHistory} from 'react-router/es6';
|
||||
|
||||
@@ -36,7 +36,7 @@ export default class RemovedFromChannelModal extends React.Component {
|
||||
var townSquare = ChannelStore.getByName('town-square');
|
||||
setTimeout(
|
||||
() => {
|
||||
browserHistory.push(Utils.getTeamURLNoOriginFromAddressBar() + '/channels/' + townSquare.name);
|
||||
browserHistory.push(TeamStore.getCurrentTeamRelativeUrl() + '/channels/' + townSquare.name);
|
||||
},
|
||||
1);
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
import $ from 'jquery';
|
||||
import UserProfile from './user_profile.jsx';
|
||||
|
||||
import TeamStore from 'stores/team_store.jsx';
|
||||
import UserStore from 'stores/user_store.jsx';
|
||||
|
||||
import * as GlobalActions from 'actions/global_actions.jsx';
|
||||
@@ -151,7 +152,7 @@ export default class SearchResultsItem extends React.Component {
|
||||
this.hideSidebar();
|
||||
}
|
||||
this.shrinkSidebar();
|
||||
browserHistory.push('/' + window.location.pathname.split('/')[1] + '/pl/' + post.id);
|
||||
browserHistory.push(TeamStore.getCurrentTeamRelativeUrl() + '/pl/' + post.id);
|
||||
}
|
||||
}
|
||||
className='search-item__jump'
|
||||
|
||||
Ссылка в новой задаче
Block a user