From f4b99c81773038005c0e705c6287309a886d54eb Mon Sep 17 00:00:00 2001 From: Jessica McKellar Date: Tue, 21 May 2013 10:21:13 -0400 Subject: [PATCH] Fix that you have to save an edited message twice to complete the edit. (imported from commit 87226d857845c6f16cb3bc0d6ab5bb748aca5987) --- zephyr/static/js/message_edit.js | 29 ++++++++++++++--------------- 1 file changed, 14 insertions(+), 15 deletions(-) diff --git a/zephyr/static/js/message_edit.js b/zephyr/static/js/message_edit.js index 76989dc163..27cf81cf1c 100644 --- a/zephyr/static/js/message_edit.js +++ b/zephyr/static/js/message_edit.js @@ -14,22 +14,21 @@ exports.save = function (row) { if (new_content !== message.raw_content) { request.content = new_content; } - if (request.subject === undefined && - request.content === undefined) { - // If they didn't change anything, just cancel it. - return message_edit.cancel(row); - } - $.ajax({ - type: 'POST', - url: '/json/update_message', - data: request, - dataType: 'json', - success: function (data) { - if (msg_list === current_msg_list) { - message_edit.cancel(row); + if ((request.subject !== undefined) || + (request.content !== undefined)) { + $.ajax({ + type: 'POST', + url: '/json/update_message', + data: request, + dataType: 'json', + success: function (data) { + if (msg_list === current_msg_list) { + message_edit.cancel(row); + } } - } - }); + }); + } + message_edit.cancel(row); // The message will automatically get replaced when it arrives. };