Revert "Add new mute message types"

This commit is contained in:
Sarah Otts 2021-01-06 16:51:03 -05:00 committed by GitHub
parent 6d8cac4239
commit 1575ed06cf
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 7 additions and 64 deletions

View file

@ -15,7 +15,6 @@
} }
.mute-content { .mute-content {
padding-top: 16px; padding-top: 16px;
justify-content: flex-start;
} }
.mute-inner-content { .mute-inner-content {
padding: 0 32px; padding: 0 32px;

View file

@ -48,9 +48,7 @@ class ComposeComment extends React.Component {
error: null, error: null,
appealId: null, appealId: null,
muteOpen: false, muteOpen: false,
muteExpiresAtMs: this.props.muteStatus.muteExpiresAt ? muteExpiresAtMs: this.props.muteStatus.muteExpiresAt * 1000, // convert to ms
this.props.muteStatus.muteExpiresAt * 1000 : 0, // convert to ms
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
}; };
} }
@ -99,7 +97,6 @@ class ComposeComment extends React.Component {
appealId: body.appealId, appealId: body.appealId,
muteOpen: muteOpen, muteOpen: muteOpen,
muteExpiresAtMs: muteExpiresAtMs, muteExpiresAtMs: muteExpiresAtMs,
muteType: body.status.mute_status.currentMessageType,
showWarning: showWarning showWarning: showWarning
}); });
return; return;
@ -174,34 +171,13 @@ class ComposeComment extends React.Component {
getMuteMessageInfo () { getMuteMessageInfo () {
// return the ids for the messages that are shown for this mute type // return the ids for the messages that are shown for this mute type
// Note, it will probably be passed a 'type', but right now there's only one
// If mute modals have more than one unique "step" we could pass an array of steps // If mute modals have more than one unique "step" we could pass an array of steps
const messageInfo = { return {
pii: { commentType: 'comment.type.disrespectful',
commentType: 'comment.type.pii', muteStepHeader: 'comment.disrespectful.header',
muteStepHeader: 'comment.pii.header', muteStepContent: ['comment.disrespectful.content1', 'comment.disrespectful.content2']
muteStepContent: ['comment.pii.content1', 'comment.pii.content2', 'comment.pii.content3']
},
unconstructive: {
commentType: 'comment.type.unconstructive',
muteStepHeader: 'comment.unconstructive.header',
muteStepContent: ['comment.unconstructive.content1', 'comment.unconstructive.content2']
},
vulgarity: {
commentType: 'comment.type.vulgarity',
muteStepHeader: 'comment.vulgarity.header',
muteStepContent: ['comment.vulgarity.content1', 'comment.vulgar.content2']
},
general: {
commentType: 'comment.type.disrespectful',
muteStepHeader: 'comment.disrespectful.header',
muteStepContent: ['comment.disrespectful.content1', 'comment.disrespectful.content2']
}
}; };
if (this.state.muteType && messageInfo[this.state.muteType]) {
return messageInfo[this.state.muteType];
}
return messageInfo.general;
} }
handleCancel () { handleCancel () {
@ -213,7 +189,6 @@ class ComposeComment extends React.Component {
}); });
if (this.props.onCancel) this.props.onCancel(); if (this.props.onCancel) this.props.onCancel();
} }
render () { render () {
return ( return (
<React.Fragment> <React.Fragment>
@ -339,7 +314,6 @@ ComposeComment.propTypes = {
muteStatus: PropTypes.shape({ muteStatus: PropTypes.shape({
offenses: PropTypes.array, offenses: PropTypes.array,
muteExpiresAt: PropTypes.number, muteExpiresAt: PropTypes.number,
currentMessageType: PropTypes.string,
showWarning: PropTypes.bool showWarning: PropTypes.bool
}), }),
onAddComment: PropTypes.func, onAddComment: PropTypes.func,

View file

@ -49,18 +49,5 @@
"comment.type.disrespectful": "Scratch thinks your most recent comment was disrespectful.", "comment.type.disrespectful": "Scratch thinks your most recent comment was disrespectful.",
"comment.disrespectful.header": "Make sure to be friendly and respectful when using Scratch.", "comment.disrespectful.header": "Make sure to be friendly and respectful when using Scratch.",
"comment.disrespectful.content1": "The Scratch comment filter thinks your comment was disrespectful.", "comment.disrespectful.content1": "The Scratch comment filter thinks your comment was disrespectful.",
"comment.disrespectful.content2": "Remember: There is a person behind every Scratch account and unfriendly comments can really hurt someone's feelings.", "comment.disrespectful.content2": "Remember: There is a person behind every Scratch account and unfriendly comments can really hurt someone's feelings."
"comment.type.pii": "The Scratch comment filter thought your most recent comment was sharing or asking for private information.",
"comment.pii.header": "Make sure not to share private information on Scratch.",
"comment.pii.content1": "The Scratch comment filter thinks that in your comment, you were sharing or asking for private information.",
"comment.pii.content2": "Things you share on Scratch can be seen by everyone, and can appear in search engines. Private information can be used by other people in harmful ways, so its important to keep it private.",
"comment.pii.content3": "This is a serious safety issue.",
"comment.type.unconstructive": "The Scratch comment filter thought your most recent comment was saying something bad about someones project.",
"comment.unconstructive.header": "Make sure to be supportive when commenting on other peoples projects",
"comment.unconstructive.content1": "The Scratch comment filter thinks your comment was saying something bad or mean about someones project.",
"comment.unconstructive.content2": "If you think something could be better, you can say something you like about the project, and make a suggestion about how to improve it.",
"comment.type.vulgarity": "The Scratch comment filter thought your most recent comment contained a bad word.",
"comment.vulgarity.header": "Make sure to use language thats appropriate for all ages",
"comment.vulgarity.content1": "The Scratch comment filter thinks your comment contains a bad word.",
"comment.vulgarity.content2": "Scratch has users of all ages, so its important to use language that is appropriate for all Scratchers."
} }

View file

@ -335,21 +335,4 @@ describe('Compose Comment test', () => {
expect(commentInstance.isMuted()).toBe(false); expect(commentInstance.isMuted()).toBe(false);
global.Date.now = realDateNow; global.Date.now = realDateNow;
}); });
test('getMuteMessageInfo: muteType set', () => {
const commentInstance = getComposeCommentWrapper({}).instance();
commentInstance.setState({muteType: 'unconstructive'});
expect(commentInstance.getMuteMessageInfo().commentType).toBe('comment.type.unconstructive');
});
test('getMuteMessageInfo: muteType not set', () => {
const commentInstance = getComposeCommentWrapper({}).instance();
expect(commentInstance.getMuteMessageInfo().commentType).toBe('comment.type.disrespectful');
});
test('getMuteMessageInfo: muteType set to something we don\'t have messages for', () => {
const commentInstance = getComposeCommentWrapper({}).instance();
commentInstance.setState({muteType: 'spaghetti'});
expect(commentInstance.getMuteMessageInfo().commentType).toBe('comment.type.disrespectful');
});
}); });