fix(info): respect path when linking to dial in page

This commit is contained in:
Leonard Kim 2018-03-06 09:51:45 -08:00 committed by Дамян Минков
parent 45c1438fe6
commit 824a8a8864
1 changed files with 23 additions and 2 deletions

View File

@ -268,8 +268,29 @@ class InfoDialog extends Component {
* @returns {string} * @returns {string}
*/ */
_getDialInfoPageURL() { _getDialInfoPageURL() {
return `${window.location.origin}/static/dialInInfo.html?room=${ const origin = window.location.origin;
encodeURIComponent(this.props._conferenceName)}`; const encodedConferenceName
= encodeURIComponent(this.props._conferenceName);
const pathParts = window.location.pathname.split('/');
// More than two parts implies the path consists of more than the first
// forward slash and the meeting name. If that is the case, drop the
// last segment of the path, which we assume is the meeting name. This
// is necessary when is hosted on a url with a path.
if (pathParts.length > 2) {
pathParts.length = pathParts.length - 1;
}
const newPath = pathParts.reduce((accumulator, currentValue) => {
if (currentValue) {
return `${accumulator}/${currentValue}`;
}
return accumulator;
}, '');
return `${origin}${newPath}/static/dialInInfo.html?room=${
encodedConferenceName}`;
} }
/** /**