Add comments; fix reply logic

This commit is contained in:
seotts 2021-03-19 15:18:36 -04:00
parent 94eb3dc6de
commit 5d7d1cde3d

View file

@ -28,9 +28,9 @@ const JUST_MUTED_ERROR = 'isBad';
const ComposeStatus = keyMirror({ const ComposeStatus = keyMirror({
EDITING: null, EDITING: null,
SUBMITTING: null, SUBMITTING: null,
REJECTED: null, REJECTED: null, // comment rejected for a reason other than muting (such as commenting too quickly)
REJECTED_MUTE: null, REJECTED_MUTE: null, // comment made in this ComposeComment was rejected and muted the user
COMPOSE_DISALLOWED: null COMPOSE_DISALLOWED: null // user is already muted due to past behavior
}); });
class ComposeComment extends React.Component { class ComposeComment extends React.Component {
@ -186,14 +186,14 @@ class ComposeComment extends React.Component {
return false; return false;
} }
// TODO: Check with Kathy, but we think you should always see the modal when you reply? // If the user is already muted (for example, in a different tab),
// do not show modal unless the comment is a reply. We always want to show
// the modal on replies when the user is already muted because the blue box
// may be out-of-sight for them.
if (!justMuted) {
if (this.props.isReply) { if (this.props.isReply) {
return true; return true;
} }
// If the user is already muted (for example, in a different tab),
// do not show modal because it would be confusing
if (!justMuted) {
return false; return false;
} }
@ -284,7 +284,9 @@ class ComposeComment extends React.Component {
render () { render () {
return ( return (
<React.Fragment> <React.Fragment>
{(this.isMuted() && !(this.props.isReply && this.state.status !== ComposeStatus.REJECTED_MUTE)) ? ( {/* If a user is muted, show the blue mute box, unless
the comment is a reply and the user was already muted before attempting to make it. */}
{(this.isMuted() && !(this.props.isReply && this.state.status === ComposeStatus.COMPOSE_DISALLOWED)) ? (
<FlexRow className="comment"> <FlexRow className="comment">
<CommentingStatus> <CommentingStatus>
<p> <p>