Jitsi Meet - Secure, Simple and Scalable Video Conferences that you use as a standalone app or embed in your web application.
TypeScript debiandeep-videojitsijitsi-meetscalable-video-conferencessfuvideovideo-communicationvideo-conferencingwebrtc
feat: Only show more numbers link if multiple numbers are available (#8702)
Steffen Kolmer899968d3a9ce
diff --git a/react/features/invite/components/add-people-dialog/web/DialInSection.js b/react/features/invite/components/add-people-dialog/web/DialInSection.jsindex 61da04fd15..c3e472562a 100644--- a/react/features/invite/components/add-people-dialog/web/DialInSection.js+++ b/react/features/invite/components/add-people-dialog/web/DialInSection.js@@ -4,22 +4,28 @@ import React from 'react';import { translate } from '../../../../base/i18n';import { connect } from '../../../../base/redux';-import { getDialInfoPageURL } from '../../../functions';+import { getDialInfoPageURL, hasMultipleNumbers } from '../../../functions';import DialInNumber from './DialInNumber';type Props = {/**- * The object representing the dialIn feature.+ * The numberic identifier for the current conference, used after dialing a+ * the number to join the conference.*/- _dialIn: Object,+ _conferenceID: number,/*** The url of the page containing the dial-in numbers list.*/_dialInfoPageUrl: string,+ /**+ * If multiple dial-in numbers are available+ */+ _hasMultipleNumbers: boolean;+/*** The phone number to dial to begin the process of dialing into a* conference.@@ -41,23 +47,24 @@ type Props = {* @returns {null|ReactElement}*/function DialInSection({- _dialIn,+ _conferenceID,_dialInfoPageUrl,+ _hasMultipleNumbers,phoneNumber,t}: Props) {return (<div className = 'invite-more-dialog dial-in-display'><DialInNumber- conferenceID = { _dialIn.conferenceID }+ conferenceID = { _conferenceID }phoneNumber = { phoneNumber } />- <a+ {_hasMultipleNumbers ? <aclassName = 'more-numbers'href = { _dialInfoPageUrl }rel = 'noopener noreferrer'target = '_blank'>{ t('info.moreNumbers') }- </a>+ </a> : null}</div>);}@@ -72,9 +79,12 @@ function DialInSection({* @returns {Props}*/function _mapStateToProps(state) {+ const dialIn = state['features/invite'];+return {- _dialIn: state['features/invite'],- _dialInfoPageUrl: getDialInfoPageURL(state)+ _conferenceID: dialIn.conferenceID,+ _dialInfoPageUrl: getDialInfoPageURL(state),+ _hasMultipleNumbers: hasMultipleNumbers(dialIn.numbers)};}diff --git a/react/features/invite/functions.js b/react/features/invite/functions.jsindex 85cf51f456..9484513982 100644--- a/react/features/invite/functions.js+++ b/react/features/invite/functions.js@@ -588,6 +588,31 @@ export function shouldDisplayDialIn(dialIn: Object) {&& phoneNumber);}+/**+ * Returns if multiple dial-in numbers are available.+ *+ * @param {Array<string>|Object} dialInNumbers - The array or object of+ * numbers to check.+ * @private+ * @returns {boolean}+ */+export function hasMultipleNumbers(dialInNumbers: ?Object) {+ if (!dialInNumbers) {+ return false;+ }++ if (Array.isArray(dialInNumbers)) {+ return dialInNumbers.length > 1;+ }++ // deprecated and will be removed+ const { numbers } = dialInNumbers;++ // eslint-disable-next-line no-confusing-arrow+ return Boolean(numbers && Object.values(numbers).map(a => Array.isArray(a) ? a.length : 0)+ .reduce((a, b) => a + b) > 1);+}+/*** Sets the internal state of which dial-in number to display.*