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.

AbstractMuteRemoteParticipantDialog.js 1.5KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. // @flow
  2. import { Component } from 'react';
  3. import {
  4. createRemoteMuteConfirmedEvent,
  5. sendAnalytics
  6. } from '../../analytics';
  7. import { muteRemoteParticipant } from '../../base/participants';
  8. /**
  9. * The type of the React {@code Component} props of
  10. * {@link AbstractMuteRemoteParticipantDialog}.
  11. */
  12. type Props = {
  13. /**
  14. * The Redux dispatch function.
  15. */
  16. dispatch: Function,
  17. /**
  18. * The ID of the remote participant to be muted.
  19. */
  20. participantID: string,
  21. /**
  22. * Function to translate i18n labels.
  23. */
  24. t: Function
  25. };
  26. /**
  27. * Abstract dialog to confirm a remote participant mute action.
  28. *
  29. * @extends Component
  30. */
  31. export default class AbstractMuteRemoteParticipantDialog
  32. extends Component<Props> {
  33. /**
  34. * Initializes a new {@code AbstractMuteRemoteParticipantDialog} instance.
  35. *
  36. * @param {Object} props - The read-only properties with which the new
  37. * instance is to be initialized.
  38. */
  39. constructor(props: Props) {
  40. super(props);
  41. // Bind event handlers so they are only bound once per instance.
  42. this._onSubmit = this._onSubmit.bind(this);
  43. }
  44. _onSubmit: () => boolean;
  45. /**
  46. * Handles the submit button action.
  47. *
  48. * @private
  49. * @returns {boolean} - True (to note that the modal should be closed).
  50. */
  51. _onSubmit() {
  52. const { dispatch, participantID } = this.props;
  53. sendAnalytics(createRemoteMuteConfirmedEvent(participantID));
  54. dispatch(muteRemoteParticipant(participantID));
  55. return true;
  56. }
  57. }