Draft: open mute modal from reply button if you're muted.

This commit is contained in:
picklesrus 2021-02-02 11:34:27 -05:00
parent f60a8c71a0
commit f7bf204924
3 changed files with 7 additions and 3 deletions

View file

@ -37,7 +37,7 @@ class MuteModal extends React.Component {
this.numSteps = this.props.showWarning ? steps.BAN_WARNING : steps.MUTE_INFO; this.numSteps = this.props.showWarning ? steps.BAN_WARNING : steps.MUTE_INFO;
this.state = { this.state = {
step: steps.COMMENT_ISSUE step: this.props.startStep ? this.props.startStep : steps.COMMENT_ISSUE
}; };
} }
handleNext () { handleNext () {
@ -240,6 +240,7 @@ MuteModal.propTypes = {
}), }),
onRequestClose: PropTypes.func, onRequestClose: PropTypes.func,
showWarning: PropTypes.bool, showWarning: PropTypes.bool,
startStep: PropTypes.number,
timeMuted: PropTypes.string timeMuted: PropTypes.string
}; };

View file

@ -231,6 +231,7 @@ class Comment extends React.Component {
{this.state.replying ? ( {this.state.replying ? (
<FlexRow className="comment-reply-row"> <FlexRow className="comment-reply-row">
<ComposeComment <ComposeComment
isReply
commenteeId={author.id} commenteeId={author.id}
parentId={parentId || id} parentId={parentId || id}
projectId={projectId} projectId={projectId}

View file

@ -50,7 +50,7 @@ class ComposeComment extends React.Component {
status: ComposeStatus.EDITING, status: ComposeStatus.EDITING,
error: null, error: null,
appealId: null, appealId: null,
muteOpen: false, muteOpen: muteExpiresAtMs > Date.now() && this.props.isReply,
muteExpiresAtMs: muteExpiresAtMs, muteExpiresAtMs: muteExpiresAtMs,
muteType: this.props.muteStatus.currentMessageType, muteType: this.props.muteStatus.currentMessageType,
showWarning: this.props.muteStatus.showWarning ? this.props.muteStatus.showWarning : false showWarning: this.props.muteStatus.showWarning ? this.props.muteStatus.showWarning : false
@ -232,7 +232,7 @@ class ComposeComment extends React.Component {
render () { render () {
return ( return (
<React.Fragment> <React.Fragment>
{this.isMuted() ? ( {(this.isMuted() && !this.props.isReply) ? (
<FlexRow className="comment"> <FlexRow className="comment">
<CommentingStatus> <CommentingStatus>
<p><FormattedMessage id={this.getMuteMessageInfo().commentType} /></p> <p><FormattedMessage id={this.getMuteMessageInfo().commentType} /></p>
@ -344,6 +344,7 @@ class ComposeComment extends React.Component {
muteModalMessages={this.getMuteMessageInfo()} muteModalMessages={this.getMuteMessageInfo()}
shouldCloseOnOverlayClick={false} shouldCloseOnOverlayClick={false}
showWarning={this.state.showWarning} showWarning={this.state.showWarning}
startStep={this.props.isReply ? 1 : 0}
timeMuted={formatTime.formatRelativeTime(this.state.muteExpiresAtMs, window._locale)} timeMuted={formatTime.formatRelativeTime(this.state.muteExpiresAtMs, window._locale)}
onRequestClose={this.handleMuteClose} onRequestClose={this.handleMuteClose}
/> />
@ -355,6 +356,7 @@ class ComposeComment extends React.Component {
ComposeComment.propTypes = { ComposeComment.propTypes = {
commenteeId: PropTypes.number, commenteeId: PropTypes.number,
isReply: PropTypes.bool,
muteStatus: PropTypes.shape({ muteStatus: PropTypes.shape({
offenses: PropTypes.array, offenses: PropTypes.array,
muteExpiresAt: PropTypes.number, muteExpiresAt: PropTypes.number,