mirror of
https://github.com/zulip/zulip.git
synced 2025-11-05 14:35:27 +00:00
local echo: Fix type errors for message_send_error.
The function message_send_error was messing up on calls to message.get when we were passing in string versions of `local_id`. Now we pass in float ids. This fixes a traceback where we tried to set `.failed_request` on to an `undefined` value that we had instead expected to be a locally echoed message from our message store.
This commit is contained in:
@@ -697,7 +697,7 @@ run_test('send_message', () => {
|
|||||||
let echo_error_msg_checked;
|
let echo_error_msg_checked;
|
||||||
|
|
||||||
echo.message_send_error = function (local_id, error_response) {
|
echo.message_send_error = function (local_id, error_response) {
|
||||||
assert.equal(local_id, '123.04');
|
assert.equal(local_id, 123.04);
|
||||||
assert.equal(error_response, 'Error sending message: Server says 408');
|
assert.equal(error_response, 'Error sending message: Server says 408');
|
||||||
echo_error_msg_checked = true;
|
echo_error_msg_checked = true;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -342,7 +342,7 @@ exports.send_message = function send_message(request) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
echo.message_send_error(local_id, response);
|
echo.message_send_error(message.id, response);
|
||||||
}
|
}
|
||||||
|
|
||||||
transmit.send_message(request, success, error);
|
transmit.send_message(request, success, error);
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ function resend_message(message, row) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function on_error(response) {
|
function on_error(response) {
|
||||||
exports.message_send_error(local_id, response);
|
exports.message_send_error(message.id, response);
|
||||||
setTimeout(function () {
|
setTimeout(function () {
|
||||||
retry_spinner.toggleClass('rotating', false);
|
retry_spinner.toggleClass('rotating', false);
|
||||||
}, 300);
|
}, 300);
|
||||||
@@ -333,10 +333,10 @@ exports._patch_waiting_for_ack = function (data) {
|
|||||||
waiting_for_ack = data;
|
waiting_for_ack = data;
|
||||||
};
|
};
|
||||||
|
|
||||||
exports.message_send_error = function (local_id, error_response) {
|
exports.message_send_error = function (message_id, error_response) {
|
||||||
// Error sending message, show inline
|
// Error sending message, show inline
|
||||||
message_store.get(local_id).failed_request = true;
|
message_store.get(message_id).failed_request = true;
|
||||||
ui.show_message_failed(local_id, error_response);
|
ui.show_message_failed(message_id, error_response);
|
||||||
};
|
};
|
||||||
|
|
||||||
function abort_message(message) {
|
function abort_message(message) {
|
||||||
|
|||||||
Reference in New Issue
Block a user