From 54744dd3a92ec30b8c95effc2172d933c4c3ebae Mon Sep 17 00:00:00 2001 From: Dan Helfman Date: Fri, 21 Nov 2008 12:56:06 -0800 Subject: [PATCH] Fixed a rare bug in which Luminotes sometimes indicated that the current note was saved even when it wasn't. Fortunately, this was just a visual bug, and the current note was always saved correctly. The reproduction steps were: 1. Open two notes, A and B. 2. Modify note A, and then switch to note B. This causes note A to save. 3. The save happens to take a long time (which you can force with a sleep). 4. While the save is executing, quickly modifiy note B. 5. When the original save completes, the "save" button changes to "saved", even though note B has been modified and is not saved. The solution was simply to check whether the focused note is dirty before changing to a "saved" button. --- NEWS | 3 +++ static/js/Wiki.js | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/NEWS b/NEWS index 61b085b..55f6a8a 100644 --- a/NEWS +++ b/NEWS @@ -1,5 +1,8 @@ 1.5.8: * Fixed a bug that prevented the autosaver from working on all notebooks. + * Fixed a rare bug in which Luminotes sometimes indicated that the current + note was saved even when it wasn't. Fortunately, this was just a visual + bug, and the current note was always saved correctly. 1.5.7: November 18, 2008 * Rearranged the links on the left and right side of the wiki editing page diff --git a/static/js/Wiki.js b/static/js/Wiki.js index 4b55455..f9591c9 100644 --- a/static/js/Wiki.js +++ b/static/js/Wiki.js @@ -1611,7 +1611,7 @@ Wiki.prototype.save_editor = function ( editor, fire_and_forget, callback, synch editor.mark_clean(); var save_button = getElement( "save_button" ); - if ( save_button ) { + if ( save_button && self.focused_editor && !self.focused_editor.dirty() ) { save_button.disabled = true; save_button.value = "saved"; } @@ -1632,7 +1632,7 @@ Wiki.prototype.save_editor = function ( editor, fire_and_forget, callback, synch }, null, synchronous, fire_and_forget ); } else { var save_button = getElement( "save_button" ); - if ( save_button ) { + if ( save_button && this.focused_editor && !this.focused_editor.dirty() ) { save_button.disabled = true; save_button.value = "saved"; }