fix for breakage around forwarding review

This commit is contained in:
or-else
2022-05-12 18:29:21 -07:00
parent 5087a70d5e
commit a9e4f644a2
7 changed files with 33 additions and 38 deletions
+8 -12
View File
@@ -226,16 +226,6 @@ class MessagesView extends React.Component {
} else if (nextProps.topic != prevState.topic) {
const topic = nextProps.tinode.getTopic(nextProps.topic);
let reply = null;
if (nextProps.forwardMessage) {
// We are forwarding a message. Show preview.
const preview = nextProps.forwardMessage.preview;
reply = {
content: preview,
seq: null
};
}
nextState = {
topic: nextProps.topic,
docPreview: null,
@@ -244,11 +234,18 @@ class MessagesView extends React.Component {
typingIndicator: false,
scrollPosition: 0,
fetchingMessages: false,
reply: reply,
showGoToLastButton: false,
deleted: topic._deleted
};
if (nextProps.forwardMessage) {
// We are forwarding a message. Show preview.
nextState.reply = {
content: nextProps.forwardMessage.preview,
seq: null
};
}
if (topic) {
// Topic exists.
const subs = [];
@@ -926,7 +923,6 @@ class MessagesView extends React.Component {
// seq: seq ID of the source message
// context: message content.
// forwarded: true if the source message is also a forwarded message.
// senderId: UID of the sender of the source message.
// senderName: full name of the sender of the original message.
handlePickReply(seq, content, senderId, senderName) {
+1 -1
View File
@@ -217,7 +217,7 @@ export default class AudioPlayer extends React.PureComponent {
}
handleError(err) {
console.log(err);
console.error(err);
}
handleSeek(e) {
+6 -5
View File
@@ -84,7 +84,8 @@ class SendMessage extends React.PureComponent {
if (prevProps.topicName != this.props.topicName) {
this.setState({message: '', audioRec: false, quote: null});
} else if (prevProps.reply != this.props.reply) {
}
if (prevProps.reply != this.props.reply) {
this.setState({quote: this.formatReply()});
}
}
@@ -196,17 +197,17 @@ class SendMessage extends React.PureComponent {
formatMessage(messages[this.props.messagePrompt]) :
formatMessage(messages.type_new_message));
const quote =
const quote = this.state.quote ?
(<div id="reply-quote-preview">
<div className="cancel">
<a href="#" onClick={(e) => {e.preventDefault(); this.props.onCancelReply();}}><i className="material-icons gray">close</i></a>
</div>
{this.state.quote}
</div>);
</div>) : null;
const audioEnabled = this.state.audioAvailable && this.props.onAttachAudio;
return (
<div id="send-message-wrapper">
{this.state.quote && !this.props.noInput ? quote : null}
{!this.props.noInput ? quote : null}
<div id="send-message-panel">
{!this.props.disabled ?
<>
@@ -222,7 +223,7 @@ class SendMessage extends React.PureComponent {
:
null}
{this.props.noInput ?
(this.state.quote ? quote : <div className="hr thin" />) :
(quote || <div className="hr thin" />) :
(this.state.audioRec ?
<AudioRecorder
onDeleted={_ => this.setState({audioRec: false})}