fix(prejoin): Show decoded version of meeting uri

This commit is contained in:
Vlad Piersec 2020-07-15 13:07:10 +03:00 committed by Saúl Ibarra Corretgé
parent b85cd2348f
commit ef0af1a8c0
3 changed files with 14 additions and 4 deletions

View File

@ -6,7 +6,7 @@ import { getCurrentConferenceUrl } from '../../../connection';
import { translate } from '../../../i18n';
import { Icon, IconCopy, IconCheck } from '../../../icons';
import { connect } from '../../../redux';
import { copyText } from '../../../util';
import { copyText, getDecodedURI } from '../../../util';
type Props = {
@ -156,7 +156,7 @@ class CopyMeetingUrl extends Component<Props, State> {
className = { `url ${showLinkCopied ? 'done' : ''}` }
onClick = { _copyUrl } >
<div className = 'copy-meeting-text'>
{ !showCopyLink && !showLinkCopied && url }
{ !showCopyLink && !showLinkCopied && getDecodedURI(url) }
{ showCopyLink && t('prejoin.copyAndShare') }
{ showLinkCopied && t('prejoin.linkCopied') }
</div>

View File

@ -591,3 +591,13 @@ export function addHashParamsToURL(url: URL, hashParamsToAdd: Object = {}) {
return url;
}
/**
* Returns the decoded URI.
*
* @param {string} uri - The URI to decode.
* @returns {string}
*/
export function getDecodedURI(uri: string) {
return decodeURI(uri.replace(/^https?:\/\//i, ''));
}

View File

@ -4,7 +4,7 @@ import React, { useState } from 'react';
import { translate } from '../../../../base/i18n';
import { Icon, IconCheck, IconCopy } from '../../../../base/icons';
import { copyText } from '../../../../base/util';
import { copyText, getDecodedURI } from '../../../../base/util';
type Props = {
@ -82,7 +82,7 @@ function CopyMeetingLinkSection({ t, url }: Props) {
);
}
const displayUrl = decodeURI(url.replace(/^https?:\/\//i, ''));
const displayUrl = getDecodedURI(url);
return (
<>