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.any.js 1.2KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. // @flow
  2. import { type Dispatch } from 'redux';
  3. import {
  4. getCurrentConference
  5. } from '../base/conference';
  6. /**
  7. * Action to toggle lobby mode on or off.
  8. *
  9. * @param {boolean} enabled - The desired (new) state of the lobby mode.
  10. * @returns {Function}
  11. */
  12. export function toggleLobbyMode(enabled: boolean) {
  13. return async (dispatch: Dispatch<any>, getState: Function) => {
  14. const conference = getCurrentConference(getState);
  15. if (enabled) {
  16. conference.enableLobby();
  17. } else {
  18. conference.disableLobby();
  19. }
  20. };
  21. }
  22. /**
  23. * Approves (lets in) or rejects a knocking participant.
  24. *
  25. * @param {string} id - The id of the knocking participant.
  26. * @param {boolean} approved - True if the participant is approved, false otherwise.
  27. * @returns {Function}
  28. */
  29. export function setKnockingParticipantApproval(id: string, approved: boolean) {
  30. return async (dispatch: Dispatch<any>, getState: Function) => {
  31. const conference = getCurrentConference(getState);
  32. if (conference) {
  33. if (approved) {
  34. conference.lobbyApproveAccess(id);
  35. } else {
  36. conference.lobbyDenyAccess(id);
  37. }
  38. }
  39. };
  40. }