2020-07-15 10:13:28 +00:00
|
|
|
// @flow
|
|
|
|
|
|
|
|
import { Component } from 'react';
|
|
|
|
|
|
|
|
import {
|
|
|
|
createRemoteVideoMenuButtonEvent,
|
|
|
|
sendAnalytics
|
|
|
|
} from '../../analytics';
|
2021-09-10 11:05:16 +00:00
|
|
|
import { getParticipantById, grantModerator } from '../../base/participants';
|
2020-07-15 10:13:28 +00:00
|
|
|
|
|
|
|
type Props = {
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The Redux dispatch function.
|
|
|
|
*/
|
|
|
|
dispatch: Function,
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The ID of the remote participant to be granted moderator rights.
|
|
|
|
*/
|
|
|
|
participantID: string,
|
|
|
|
|
2021-09-10 11:05:16 +00:00
|
|
|
/**
|
|
|
|
* The name of the remote participant to be granted moderator rights.
|
|
|
|
*/
|
|
|
|
participantName: string,
|
|
|
|
|
2020-07-15 10:13:28 +00:00
|
|
|
/**
|
|
|
|
* Function to translate i18n labels.
|
|
|
|
*/
|
|
|
|
t: Function
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Abstract dialog to confirm granting moderator to a participant.
|
|
|
|
*/
|
|
|
|
export default class AbstractGrantModeratorDialog
|
|
|
|
extends Component<Props> {
|
|
|
|
/**
|
|
|
|
* Initializes a new {@code AbstractGrantModeratorDialog} instance.
|
|
|
|
*
|
|
|
|
* @inheritdoc
|
|
|
|
*/
|
|
|
|
constructor(props: Props) {
|
|
|
|
super(props);
|
|
|
|
|
|
|
|
this._onSubmit = this._onSubmit.bind(this);
|
|
|
|
}
|
|
|
|
|
|
|
|
_onSubmit: () => boolean;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Callback for the confirm button.
|
|
|
|
*
|
|
|
|
* @private
|
|
|
|
* @returns {boolean} - True (to note that the modal should be closed).
|
|
|
|
*/
|
|
|
|
_onSubmit() {
|
|
|
|
const { dispatch, participantID } = this.props;
|
|
|
|
|
|
|
|
sendAnalytics(createRemoteVideoMenuButtonEvent(
|
|
|
|
'grant.moderator.button',
|
|
|
|
{
|
|
|
|
'participant_id': participantID
|
|
|
|
}));
|
|
|
|
|
|
|
|
dispatch(grantModerator(participantID));
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
2021-09-10 11:05:16 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Maps (parts of) the Redux state to the associated {@code AbstractMuteEveryoneDialog}'s props.
|
|
|
|
*
|
|
|
|
* @param {Object} state - The redux state.
|
|
|
|
* @param {Object} ownProps - The properties explicitly passed to the component.
|
|
|
|
* @returns {Props}
|
|
|
|
*/
|
|
|
|
export function abstractMapStateToProps(state: Object, ownProps: Props) {
|
|
|
|
|
|
|
|
return {
|
|
|
|
participantName: getParticipantById(state, ownProps.participantID).name
|
|
|
|
};
|
|
|
|
}
|