Fix work with message in onDrop method

This commit is contained in:
Serge Adamovich
2020-04-19 20:12:44 +03:00
parent 5fc67f1c12
commit 2f966d09ca
@@ -281,11 +281,10 @@ export class CommentForm extends Component<Props, State> {
onDrop(e: DragEvent) {
const isAnonymous = this.props.user && isUserAnonymous(this.props.user);
if (!this.props.user || isAnonymous) {
const message = isAnonymous ? messages.anonymousUploadingDisabled : messages.unauthorizedUploadingDisabled;
this.setState({
isErrorShown: true,
errorMessage: this.props.intl.formatMessage(
messages[isAnonymous ? 'anonymousUploadingDisabled' : 'unauthorizedUploadingDisabled']
),
errorMessage: this.props.intl.formatMessage(message),
});
e.preventDefault();
return;