MDL-18014 Atto autosave: Correct detection of autosaving error when session expired

This commit is contained in:
Damyon Wiese
2014-08-14 12:42:37 +08:00
parent 8a5db5472e
commit c195bbffab
4 changed files with 27 additions and 10 deletions
@@ -915,9 +915,15 @@ EditorAutosave.prototype = {
Y.log(response, 'warn');
this.showMessage(M.util.get_string('autosavefailed', 'editor_atto'), 'warning', AUTOSAVE_FREQUENCY);
},
success: function() {
Y.log('Text auto-saved');
this.lastText = newText;
success: function(code, response) {
if (response !== "") {
Y.log('Failure while autosaving text.', 'warn');
Y.log(response, 'debug');
this.showMessage(M.util.get_string('autosavefailed', 'editor_atto'), 'warning', AUTOSAVE_FREQUENCY);
} else {
// All working.
this.lastText = newText;
}
}
},
context: this
File diff suppressed because one or more lines are too long
@@ -904,8 +904,13 @@ EditorAutosave.prototype = {
failure: function(code, response) {
this.showMessage(M.util.get_string('autosavefailed', 'editor_atto'), 'warning', AUTOSAVE_FREQUENCY);
},
success: function() {
this.lastText = newText;
success: function(code, response) {
if (response !== "") {
this.showMessage(M.util.get_string('autosavefailed', 'editor_atto'), 'warning', AUTOSAVE_FREQUENCY);
} else {
// All working.
this.lastText = newText;
}
}
},
context: this
+9 -3
View File
@@ -205,9 +205,15 @@ EditorAutosave.prototype = {
Y.log(response, 'warn');
this.showMessage(M.util.get_string('autosavefailed', 'editor_atto'), 'warning', AUTOSAVE_FREQUENCY);
},
success: function() {
Y.log('Text auto-saved');
this.lastText = newText;
success: function(code, response) {
if (response !== "") {
Y.log('Failure while autosaving text.', 'warn');
Y.log(response, 'debug');
this.showMessage(M.util.get_string('autosavefailed', 'editor_atto'), 'warning', AUTOSAVE_FREQUENCY);
} else {
// All working.
this.lastText = newText;
}
}
},
context: this