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
pull/21833/head
David Baker 2017-10-11 17:42:54 +01:00
parent ffb9dd844a
commit 5626c06b3c
1 changed files with 11 additions and 0 deletions

View File

@ -738,6 +738,17 @@ module.exports = React.createClass({
_getUnsentMessageError: function(room) { _getUnsentMessageError: function(room) {
const unsentMessages = this._getUnsentMessages(room); const unsentMessages = this._getUnsentMessages(room);
if (!unsentMessages.length) return ""; 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) { for (const event of unsentMessages) {
if (!event.error || event.error.name !== "UnknownDeviceError") { if (!event.error || event.error.name !== "UnknownDeviceError") {
return _t("Some of your messages have not been sent."); return _t("Some of your messages have not been sent.");