From 3c1152648053b672f8000eead72981ed50b5c7a3 Mon Sep 17 00:00:00 2001 From: Dan Helfman Date: Thu, 20 Nov 2008 17:39:20 -0800 Subject: [PATCH] Fixed a bug that prevented the autosaver from working on non-forum notebooks. --- NEWS | 3 +++ config/Version.py | 2 +- model/User.py | 13 +++++++------ static/js/Wiki.js | 2 +- 4 files changed, 12 insertions(+), 8 deletions(-) diff --git a/NEWS b/NEWS index eeb4b4d..61b085b 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,6 @@ +1.5.8: + * Fixed a bug that prevented the autosaver from working on all notebooks. + 1.5.7: November 18, 2008 * Rearranged the links on the left and right side of the wiki editing page so that the note title links have a little more horizontal breathing room. diff --git a/config/Version.py b/config/Version.py index ece6e15..e8d7099 100644 --- a/config/Version.py +++ b/config/Version.py @@ -1 +1 @@ -VERSION = u"1.5.7" +VERSION = u"1.5.8" diff --git a/model/User.py b/model/User.py index f97d0be..0255b89 100644 --- a/model/User.py +++ b/model/User.py @@ -417,19 +417,20 @@ class User( Persistent ): def sql_calculate_storage( self, database_backend ): """ Return a SQL string to calculate the total bytes of storage usage by this user. This includes - storage for all the user's notes (including past revisions) and their uploaded files. It does + storage for all the user's notes (excluding past revisions) and their uploaded files. It does not include storage for the notebooks themselves. """ if database_backend == Persistent.POSTGRESQL_BACKEND: # this counts bytes for the contents of each column - note_size_clause = "pg_column_size( note.* )" + note_size_clause = "pg_column_size( note_current.* )" else: # this isn't perfect, because length() counts UTF-8 characters instead of bytes. # some columns are left out because they can be null, which screws up the addition note_size_clause = \ """ - length( note.id ) + length( note.revision ) + length( note.title ) + length( note.contents ) + - length( note.notebook_id ) + length( note.startup ) + length( note.user_id ) + length( note_current.id ) + length( note_current.revision ) + length( note_current.title ) + + length( note_current.contents ) + length( note_current.notebook_id ) + + length( note_current.startup ) + length( note_current.user_id ) """ return \ @@ -438,11 +439,11 @@ class User( Persistent ): select coalesce( sum( %s ), 0 ) from - user_notebook, note + user_notebook, note_current where user_notebook.user_id = %s and user_notebook.owner = 't' and - note.notebook_id = user_notebook.notebook_id + note_current.notebook_id = user_notebook.notebook_id ) as note_storage, ( select diff --git a/static/js/Wiki.js b/static/js/Wiki.js index 2851d22..4b55455 100644 --- a/static/js/Wiki.js +++ b/static/js/Wiki.js @@ -66,7 +66,7 @@ function Wiki( invoker ) { this.display_message( "Luminotes support for your web browser (" + beta_agent + ") is currently in beta. If you encounter any problems, please contact support so that they can be fixed!" ); } - if ( this.notebook_has_tag( this.notebook, "forum" ) ) + if ( !this.notebook_has_tag( this.notebook, "forum" ) ) this.autosaver = Autosaver( this ); var deleted_id = getElement( "deleted_id" ).value;