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 1.7KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. import { setPassword } from '../base/conference';
  2. import { BEGIN_ROOM_LOCK_REQUEST, END_ROOM_LOCK_REQUEST } from './actionTypes';
  3. import './reducer';
  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({
  20. type: BEGIN_ROOM_LOCK_REQUEST,
  21. conference
  22. });
  23. }
  24. };
  25. }
  26. /**
  27. * Ends a (user) request to lock a specific conference/room.
  28. *
  29. * @param {JitsiConference} conference - The JitsiConference to lock.
  30. * @param {string|undefined} password - The password with which the specified
  31. * conference is to be locked or undefined to cancel the (user) request to lock
  32. * the specified conference.
  33. * @returns {Function}
  34. */
  35. export function endRoomLockRequest(conference, password) {
  36. return dispatch => {
  37. const setPassword_
  38. = password
  39. ? dispatch(setPassword(conference, conference.lock, password))
  40. : Promise.resolve();
  41. const endRoomLockRequest_ = () => {
  42. dispatch({
  43. type: END_ROOM_LOCK_REQUEST,
  44. conference,
  45. password
  46. });
  47. };
  48. setPassword_.then(endRoomLockRequest_, endRoomLockRequest_);
  49. };
  50. }