Code review suggestions.

This commit is contained in:
aforge
2021-09-01 17:07:18 +03:00
parent c408cc12c8
commit 21d3115346
5 changed files with 104 additions and 73 deletions
+5 -2
View File
@@ -62,7 +62,8 @@ class BaseChatMessage extends React.PureComponent {
e.preventDefault();
e.stopPropagation();
const menuItems = this.props.received == Tinode.MESSAGE_STATUS_FAILED ? ['menu_item_send_retry'] : [];
if (this.props.received >= Tinode.MESSAGE_STATUS_FAILED &&
if (this.props.userIsWriter &&
this.props.received > Tinode.MESSAGE_STATUS_FAILED &&
this.props.received < Tinode.MESSAGE_STATUS_DEL_RANGE) {
menuItems.push('menu_item_reply');
}
@@ -82,7 +83,9 @@ class BaseChatMessage extends React.PureComponent {
e.preventDefault();
e.stopPropagation();
const replyToSeq = this.props.replyToSeq;
this.props.onQuoteClick(replyToSeq);
if (replyToSeq) {
this.props.onQuoteClick(replyToSeq);
}
}
render() {
+1 -1
View File
@@ -46,7 +46,7 @@ export default class DocPreview extends React.PureComponent {
<SendMessage
noInput={true}
tinode={this.props.tinode}
viewportWidth={this.props.viewportWidth}
viewportWidth={this.props.viewportWidth} // Used by `formatter`.
replyTo={this.props.replyTo}
formatter={this.props.formatter}
onCancelReply={this.props.onCancelReply}
+1 -1
View File
@@ -74,7 +74,7 @@ export default class ImagePreview extends React.PureComponent {
messagePrompt="add_image_caption"
acceptBlank={true}
tinode={this.props.tinode}
viewportWidth={this.props.viewportWidth}
viewportWidth={this.props.viewportWidth} // Used by `formatter`.
replyTo={this.props.replyTo}
formatter={this.props.formatter}
onCancelReply={this.props.onCancelReply}