From da24e28a92175c01115a128469da2ff31ec1e523 Mon Sep 17 00:00:00 2001 From: or-else Date: Sat, 6 Oct 2018 12:44:24 +0300 Subject: [PATCH] start handling MESSAGE_STATUS_FAILED --- src/webapp.jsx | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/src/webapp.jsx b/src/webapp.jsx index 09617309..0d26a714 100644 --- a/src/webapp.jsx +++ b/src/webapp.jsx @@ -3619,19 +3619,26 @@ class ChatMessage extends React.Component { /* Received/read indicator */ class ReceivedMarker extends React.PureComponent { render() { - var timestamp = (this.props.received <= Tinode.MESSAGE_STATUS_SENDING) ? - "sending ..." : - shortDateFormat(this.props.timestamp); + let timestamp; + if (this.props.received <= Tinode.MESSAGE_STATUS_SENDING) { + timestamp = "sending ..."; + } else if (this.props.received == Tinode.MESSAGE_STATUS_FAILED) { + timestamp = "failed"; + } else { + timestamp = shortDateFormat(this.props.timestamp); + } - var marker = null; + let marker = null; if (this.props.received <= Tinode.MESSAGE_STATUS_SENDING) { marker = (access_time); // watch face + } else if (this.props.received == Tinode.MESSAGE_STATUS_FAILED) { + marker = (error_outline); // icon (!) } else if (this.props.received == Tinode.MESSAGE_STATUS_SENT) { marker = (done); // checkmark } else if (this.props.received == Tinode.MESSAGE_STATUS_RECEIVED) { marker = (done_all); // double checkmark } else if (this.props.received == Tinode.MESSAGE_STATUS_READ) { - marker = (done_all); // open eye + marker = (done_all); // blue double checkmark } return ( @@ -4004,7 +4011,7 @@ class MessagesView extends React.Component { newState.scrollPosition = 0; } - // Aknowledge all messages, including own messges. + // Aknowledge all messages, including own messages. let status = topic.msgStatus(msg); if (status >= Tinode.MESSAGE_STATUS_SENT) { this.props.readTimerHandler(() => { @@ -4979,7 +4986,7 @@ class TinodeWeb extends React.Component { // Sending "received" notifications tnData(data) { let topic = this.tinode.getTopic(data.topic); - if (topic.msgStatus(data) > Tinode.MESSAGE_STATUS_SENDING) { + if (topic.msgStatus(data) >= Tinode.MESSAGE_STATUS_SENT) { clearTimeout(this.receivedTimer); this.receivedTimer = setTimeout(() => { this.receivedTimer = undefined;