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.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. // @flow
  2. import { setPassword } from '../base/conference';
  3. import { hideDialog, openDialog } from '../base/dialog';
  4. import { PasswordRequiredPrompt, RoomLockPrompt } from './components';
  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: ?Object) {
  13. return (dispatch: Function, getState: Function) => {
  14. if (typeof conference === 'undefined') {
  15. // eslint-disable-next-line no-param-reassign
  16. conference = getState()['features/base/conference'].conference;
  17. }
  18. if (conference) {
  19. dispatch(openDialog(RoomLockPrompt, { conference }));
  20. }
  21. };
  22. }
  23. /**
  24. * Ends a (user) request to lock a specific conference/room.
  25. *
  26. * @param {JitsiConference} conference - The JitsiConference to lock.
  27. * @param {string|undefined} password - The password with which the specified
  28. * conference is to be locked or undefined to cancel the (user) request to lock
  29. * the specified conference.
  30. * @returns {Function}
  31. */
  32. export function endRoomLockRequest(
  33. conference: { lock: Function },
  34. password: ?string) {
  35. return (dispatch: Function) => {
  36. const setPassword_
  37. = password
  38. ? dispatch(setPassword(conference, conference.lock, password))
  39. : Promise.resolve();
  40. const endRoomLockRequest_ = () => dispatch(hideDialog(RoomLockPrompt));
  41. setPassword_.then(endRoomLockRequest_, endRoomLockRequest_);
  42. };
  43. }
  44. /**
  45. * Begins a request to enter password for a specific conference/room.
  46. *
  47. * @param {JitsiConference} conference - The JitsiConference
  48. * requesting password.
  49. * @protected
  50. * @returns {{
  51. * type: OPEN_DIALOG,
  52. * component: Component,
  53. * props: PropTypes
  54. * }}
  55. */
  56. export function _openPasswordRequiredPrompt(conference: Object) {
  57. return openDialog(PasswordRequiredPrompt, { conference });
  58. }