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

AbstractGrantModeratorDialog.js 1.9KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. // @flow
  2. import { Component } from 'react';
  3. import {
  4. createRemoteVideoMenuButtonEvent,
  5. sendAnalytics
  6. } from '../../analytics';
  7. import { getParticipantById, grantModerator } from '../../base/participants';
  8. type Props = {
  9. /**
  10. * The Redux dispatch function.
  11. */
  12. dispatch: Function,
  13. /**
  14. * The ID of the remote participant to be granted moderator rights.
  15. */
  16. participantID: string,
  17. /**
  18. * The name of the remote participant to be granted moderator rights.
  19. */
  20. participantName: string,
  21. /**
  22. * Function to translate i18n labels.
  23. */
  24. t: Function
  25. };
  26. /**
  27. * Abstract dialog to confirm granting moderator to a participant.
  28. */
  29. export default class AbstractGrantModeratorDialog
  30. extends Component<Props> {
  31. /**
  32. * Initializes a new {@code AbstractGrantModeratorDialog} instance.
  33. *
  34. * @inheritdoc
  35. */
  36. constructor(props: Props) {
  37. super(props);
  38. this._onSubmit = this._onSubmit.bind(this);
  39. }
  40. _onSubmit: () => boolean;
  41. /**
  42. * Callback for the confirm button.
  43. *
  44. * @private
  45. * @returns {boolean} - True (to note that the modal should be closed).
  46. */
  47. _onSubmit() {
  48. const { dispatch, participantID } = this.props;
  49. sendAnalytics(createRemoteVideoMenuButtonEvent(
  50. 'grant.moderator.button',
  51. {
  52. 'participant_id': participantID
  53. }));
  54. dispatch(grantModerator(participantID));
  55. return true;
  56. }
  57. }
  58. /**
  59. * Maps (parts of) the Redux state to the associated {@code AbstractMuteEveryoneDialog}'s props.
  60. *
  61. * @param {Object} state - The redux state.
  62. * @param {Object} ownProps - The properties explicitly passed to the component.
  63. * @returns {Props}
  64. */
  65. export function abstractMapStateToProps(state: Object, ownProps: Props) {
  66. return {
  67. participantName: getParticipantById(state, ownProps.participantID).name
  68. };
  69. }