From 5626c06b3ccc0de5b02ea4ab9ced91f7f0fd6651 Mon Sep 17 00:00:00 2001 From: David Baker Date: Wed, 11 Oct 2017 17:42:54 +0100 Subject: [PATCH] Show failures when sending messages This is useful for the spam checking where otherwise you don't really know why your message has failed to send --- src/components/structures/RoomView.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/components/structures/RoomView.js b/src/components/structures/RoomView.js index e0332b1b19..e5c730233d 100644 --- a/src/components/structures/RoomView.js +++ b/src/components/structures/RoomView.js @@ -738,6 +738,17 @@ module.exports = React.createClass({ _getUnsentMessageError: function(room) { const unsentMessages = this._getUnsentMessages(room); if (!unsentMessages.length) return ""; + + if ( + unsentMessages.length === 1 && + unsentMessages[0].error && + unsentMessages[0].error.data && + unsentMessages[0].error.data.error && + unsentMessages[0].error.name !== "UnknownDeviceError" + ) { + return unsentMessages[0].error.data.error; + } + for (const event of unsentMessages) { if (!event.error || event.error.name !== "UnknownDeviceError") { return _t("Some of your messages have not been sent.");