mirror of
https://github.com/scratchfoundation/scratch-www.git
synced 2024-11-30 10:58:23 -05:00
Add comments; fix reply logic
This commit is contained in:
parent
94eb3dc6de
commit
5d7d1cde3d
1 changed files with 13 additions and 11 deletions
|
@ -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>
|
||||||
|
|
Loading…
Reference in a new issue