您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

actions.js 2.0KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. import { setPassword } from '../base/conference';
  2. import { hideDialog, openDialog } from '../base/dialog';
  3. import { PasswordRequiredPrompt, RoomLockPrompt } from './components';
  4. /**
  5. * Begins a (user) request to lock a specific conference/room.
  6. *
  7. * @param {JitsiConference|undefined} conference - The JitsiConference to lock
  8. * if specified or undefined if the current JitsiConference is to be locked.
  9. * @returns {Function}
  10. */
  11. export function beginRoomLockRequest(conference) {
  12. return (dispatch, getState) => {
  13. if (typeof conference === 'undefined') {
  14. const state = getState();
  15. // eslint-disable-next-line no-param-reassign
  16. conference = state['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(conference, password) {
  33. return dispatch => {
  34. const setPassword_
  35. = password
  36. ? dispatch(setPassword(conference, conference.lock, password))
  37. : Promise.resolve();
  38. const endRoomLockRequest_ = () => {
  39. dispatch(hideDialog());
  40. };
  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 _showPasswordDialog(conference) {
  57. return openDialog(PasswordRequiredPrompt, { conference });
  58. }