2016-12-13 09:14:04 +00:00
|
|
|
import { setPassword } from '../base/conference';
|
2017-03-07 16:02:52 +00:00
|
|
|
import { hideDialog, openDialog } from '../base/dialog';
|
|
|
|
import { PasswordRequiredPrompt, RoomLockPrompt } from './components';
|
2016-12-13 09:14:04 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Begins a (user) request to lock a specific conference/room.
|
|
|
|
*
|
|
|
|
* @param {JitsiConference|undefined} conference - The JitsiConference to lock
|
|
|
|
* if specified or undefined if the current JitsiConference is to be locked.
|
|
|
|
* @returns {Function}
|
|
|
|
*/
|
|
|
|
export function beginRoomLockRequest(conference) {
|
|
|
|
return (dispatch, getState) => {
|
|
|
|
if (typeof conference === 'undefined') {
|
|
|
|
const state = getState();
|
|
|
|
|
|
|
|
// eslint-disable-next-line no-param-reassign
|
|
|
|
conference = state['features/base/conference'].conference;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (conference) {
|
2017-03-07 16:02:52 +00:00
|
|
|
dispatch(openDialog(RoomLockPrompt, { conference }));
|
2016-12-13 09:14:04 +00:00
|
|
|
}
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Ends a (user) request to lock a specific conference/room.
|
|
|
|
*
|
|
|
|
* @param {JitsiConference} conference - The JitsiConference to lock.
|
|
|
|
* @param {string|undefined} password - The password with which the specified
|
|
|
|
* conference is to be locked or undefined to cancel the (user) request to lock
|
|
|
|
* the specified conference.
|
|
|
|
* @returns {Function}
|
|
|
|
*/
|
|
|
|
export function endRoomLockRequest(conference, password) {
|
|
|
|
return dispatch => {
|
|
|
|
const setPassword_
|
|
|
|
= password
|
|
|
|
? dispatch(setPassword(conference, conference.lock, password))
|
|
|
|
: Promise.resolve();
|
|
|
|
const endRoomLockRequest_ = () => {
|
2017-03-07 16:02:52 +00:00
|
|
|
dispatch(hideDialog());
|
2016-12-13 09:14:04 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
setPassword_.then(endRoomLockRequest_, endRoomLockRequest_);
|
|
|
|
};
|
|
|
|
}
|
2017-03-07 03:43:41 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Begins a request to enter password for a specific conference/room.
|
|
|
|
*
|
|
|
|
* @param {JitsiConference} conference - The JitsiConference
|
|
|
|
* requesting password.
|
|
|
|
* @protected
|
|
|
|
* @returns {{
|
2017-03-07 16:02:52 +00:00
|
|
|
* type: OPEN_DIALOG,
|
2017-03-07 03:43:41 +00:00
|
|
|
* component: Component,
|
|
|
|
* props: React.PropTypes
|
|
|
|
* }}
|
|
|
|
*/
|
|
|
|
export function _showPasswordDialog(conference) {
|
|
|
|
return openDialog(PasswordRequiredPrompt, { conference });
|
|
|
|
}
|