You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

actions.js 2.2KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. import { setPassword } from '../base/conference';
  2. import { openDialog } from '../base/dialog';
  3. import { PasswordRequiredPrompt } from './components';
  4. import { BEGIN_ROOM_LOCK_REQUEST, END_ROOM_LOCK_REQUEST } from './actionTypes';
  5. /**
  6. * Begins a (user) request to lock a specific conference/room.
  7. *
  8. * @param {JitsiConference|undefined} conference - The JitsiConference to lock
  9. * if specified or undefined if the current JitsiConference is to be locked.
  10. * @returns {Function}
  11. */
  12. export function beginRoomLockRequest(conference) {
  13. return (dispatch, getState) => {
  14. if (typeof conference === 'undefined') {
  15. const state = getState();
  16. // eslint-disable-next-line no-param-reassign
  17. conference = state['features/base/conference'].conference;
  18. }
  19. if (conference) {
  20. dispatch({
  21. type: BEGIN_ROOM_LOCK_REQUEST,
  22. conference
  23. });
  24. }
  25. };
  26. }
  27. /**
  28. * Ends a (user) request to lock a specific conference/room.
  29. *
  30. * @param {JitsiConference} conference - The JitsiConference to lock.
  31. * @param {string|undefined} password - The password with which the specified
  32. * conference is to be locked or undefined to cancel the (user) request to lock
  33. * the specified conference.
  34. * @returns {Function}
  35. */
  36. export function endRoomLockRequest(conference, password) {
  37. return dispatch => {
  38. const setPassword_
  39. = password
  40. ? dispatch(setPassword(conference, conference.lock, password))
  41. : Promise.resolve();
  42. const endRoomLockRequest_ = () => {
  43. dispatch({
  44. type: END_ROOM_LOCK_REQUEST,
  45. conference,
  46. password
  47. });
  48. };
  49. setPassword_.then(endRoomLockRequest_, endRoomLockRequest_);
  50. };
  51. }
  52. /**
  53. * Begins a request to enter password for a specific conference/room.
  54. *
  55. * @param {JitsiConference} conference - The JitsiConference
  56. * requesting password.
  57. * @protected
  58. * @returns {{
  59. * type: BEGIN_DIALOG_REQUEST,
  60. * component: Component,
  61. * props: React.PropTypes
  62. * }}
  63. */
  64. export function _showPasswordDialog(conference) {
  65. return openDialog(PasswordRequiredPrompt, { conference });
  66. }