Fix that you have to save an edited message twice to complete the edit.

(imported from commit 87226d857845c6f16cb3bc0d6ab5bb748aca5987)
This commit is contained in:
Jessica McKellar 2013-05-21 10:21:13 -04:00
parent a6a3110bfb
commit f4b99c8177
1 changed files with 14 additions and 15 deletions

View File

@ -14,22 +14,21 @@ exports.save = function (row) {
if (new_content !== message.raw_content) { if (new_content !== message.raw_content) {
request.content = new_content; request.content = new_content;
} }
if (request.subject === undefined && if ((request.subject !== undefined) ||
request.content === undefined) { (request.content !== undefined)) {
// If they didn't change anything, just cancel it. $.ajax({
return message_edit.cancel(row); type: 'POST',
} url: '/json/update_message',
$.ajax({ data: request,
type: 'POST', dataType: 'json',
url: '/json/update_message', success: function (data) {
data: request, if (msg_list === current_msg_list) {
dataType: 'json', message_edit.cancel(row);
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. // The message will automatically get replaced when it arrives.
}; };