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

actions.js 1.7KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. import { setPassword } from '../base/conference';
  2. import { BEGIN_ROOM_LOCK_REQUEST, END_ROOM_LOCK_REQUEST } from './actionTypes';
  3. /**
  4. * Begins a (user) request to lock a specific conference/room.
  5. *
  6. * @param {JitsiConference|undefined} conference - The JitsiConference to lock
  7. * if specified or undefined if the current JitsiConference is to be locked.
  8. * @returns {Function}
  9. */
  10. export function beginRoomLockRequest(conference) {
  11. return (dispatch, getState) => {
  12. if (typeof conference === 'undefined') {
  13. const state = getState();
  14. // eslint-disable-next-line no-param-reassign
  15. conference = state['features/base/conference'].conference;
  16. }
  17. if (conference) {
  18. dispatch({
  19. type: BEGIN_ROOM_LOCK_REQUEST,
  20. conference
  21. });
  22. }
  23. };
  24. }
  25. /**
  26. * Ends a (user) request to lock a specific conference/room.
  27. *
  28. * @param {JitsiConference} conference - The JitsiConference to lock.
  29. * @param {string|undefined} password - The password with which the specified
  30. * conference is to be locked or undefined to cancel the (user) request to lock
  31. * the specified conference.
  32. * @returns {Function}
  33. */
  34. export function endRoomLockRequest(conference, password) {
  35. return dispatch => {
  36. const setPassword_
  37. = password
  38. ? dispatch(setPassword(conference, conference.lock, password))
  39. : Promise.resolve();
  40. const endRoomLockRequest_ = () => {
  41. dispatch({
  42. type: END_ROOM_LOCK_REQUEST,
  43. conference,
  44. password
  45. });
  46. };
  47. setPassword_.then(endRoomLockRequest_, endRoomLockRequest_);
  48. };
  49. }