Skip to content

Commit

Permalink
feat(invite): Add conference id to dial-in numbers display
Browse files Browse the repository at this point in the history
DialInNumbersForm has been modified to display a conference id to be used for
dialing into the conference. The changes include:
- Requesting the conference id and adding the conference id to the redux store
- Displaying the conference id in DialInNumbersForm
- Modifying the copy behavior to support copying the new message to clipboard
- DialInNumbersForm does not display until all ajax requests have completed
  successfully. This eliminates the need for the REQUESTING state.
  • Loading branch information
virtuacoplenny committed May 17, 2017
1 parent 896dcde commit 47c07c2
Show file tree
Hide file tree
Showing 7 changed files with 137 additions and 148 deletions.
13 changes: 13 additions & 0 deletions css/modals/invite/_invite.scss
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,19 @@

.invite-dialog {
.dial-in-numbers {
.dial-in-numbers-copy {
opacity: 0;
pointer-events: none;
position: fixed;
user-select: text;
-webkit-user-select: text;
}

.dial-in-numbers-conference-id {
color: orange;
margin-left: 3px;
}

.dial-in-numbers-trigger {
position: relative;
width: 100%;
Expand Down
9 changes: 4 additions & 5 deletions lang/main.json
Original file line number Diff line number Diff line change
Expand Up @@ -437,14 +437,13 @@
},
"invite": {
"addPassword": "Add password",
"dialInNumbers": "Dial-in telephone numbers",
"errorFetchingNumbers": "Failed to obtain dial-in numbers",
"callNumber": "Call __number__",
"enterId": "Enter Meeting ID: __meetingId__ following by # to dial in from a phone",
"howToDialIn": "To dial in, use one of the following numbers and meeting ID",
"hidePassword": "Hide password",
"inviteTo": "Invite people to __conferenceName__",
"loadingNumbers": "Loading...",
"invitedYouTo": "__userName__ has invited you to the __meetingUrl__ conference",
"locked": "This call is locked. New callers must have the link and enter the password to join.",
"noNumbers": "No numbers available",
"numbersDisabled": "Dialing in has been disabled",
"showPassword": "Show password",
"unlocked": "This call is unlocked. Any new caller with the link may join the call."
}
Expand Down
11 changes: 0 additions & 11 deletions react/features/invite/actionTypes.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,6 @@ import { Symbol } from '../base/react';
export const UPDATE_DIAL_IN_NUMBERS_FAILED
= Symbol('UPDATE_DIAL_IN_NUMBERS_FAILED');

/**
* The type of the action which signals a request for dial-in numbers has been
* started.
*
* {
* type: UPDATE_DIAL_IN_NUMBERS_REQUEST
* }
*/
export const UPDATE_DIAL_IN_NUMBERS_REQUEST
= Symbol('UPDATE_DIAL_IN_NUMBERS_REQUEST');

/**
* The type of the action which signals a request for dial-in numbers has
* succeeded.
Expand Down
57 changes: 36 additions & 21 deletions react/features/invite/actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { openDialog } from '../../features/base/dialog';

import {
UPDATE_DIAL_IN_NUMBERS_FAILED,
UPDATE_DIAL_IN_NUMBERS_REQUEST,
UPDATE_DIAL_IN_NUMBERS_SUCCESS
} from './actionTypes';
import { InviteDialog } from './components';
Expand All @@ -11,41 +10,57 @@ declare var $: Function;
declare var APP: Object;
declare var config: Object;

const CONFERENCE_ID_ENDPOINT = config.conferenceMapperUrl;
const DIAL_IN_NUMBERS_ENDPOINT = config.dialInNumbersUrl;
const MUC_URL = config && config.hosts && config.hosts.muc;

/**
* Opens the Invite Dialog.
*
* @returns {Function}
*/
export function openInviteDialog() {
return openDialog(InviteDialog, {
conferenceUrl: encodeURI(APP.ConferenceUrl.getInviteUrl()),
dialInNumbersUrl: config.dialInNumbersUrl
conferenceUrl: encodeURI(APP.ConferenceUrl.getInviteUrl())
});
}

/**
* Sends an ajax request for dial-in numbers.
* Sends an ajax requests for dial-in numbers and conference id.
*
* @param {string} dialInNumbersUrl - The endpoint for retrieving json that
* includes numbers for dialing in to a conference.
* @returns {Function}
*/
export function updateDialInNumbers(dialInNumbersUrl) {
return dispatch => {
dispatch({
type: UPDATE_DIAL_IN_NUMBERS_REQUEST
export function updateDialInNumbers() {
return (dispatch, getState) => {

if (!CONFERENCE_ID_ENDPOINT || !DIAL_IN_NUMBERS_ENDPOINT || !MUC_URL) {
return;
}

const { room } = getState()['features/base/conference'];
const conferenceIdUrl
= `${CONFERENCE_ID_ENDPOINT}?conference=${room}@${MUC_URL}`;

Promise.all([
$.getJSON(DIAL_IN_NUMBERS_ENDPOINT),
$.getJSON(conferenceIdUrl)
]).then(([ numbersResponse, idResponse ]) => {
if (!idResponse.conference || !idResponse.id) {
return Promise.reject(idResponse.message);
}

dispatch({
type: UPDATE_DIAL_IN_NUMBERS_SUCCESS,
conferenceId: idResponse,
dialInNumbers: numbersResponse
});
})
.catch(error => {
dispatch({
type: UPDATE_DIAL_IN_NUMBERS_FAILED,
error
});
});

$.getJSON(dialInNumbersUrl)
.success(response =>
dispatch({
type: UPDATE_DIAL_IN_NUMBERS_SUCCESS,
response
}))
.error(error =>
dispatch({
type: UPDATE_DIAL_IN_NUMBERS_FAILED,
error
}));
};
}
Loading

0 comments on commit 47c07c2

Please sign in to comment.