diff --git a/controller/Users.py b/controller/Users.py index 7335bc2..9224ce4 100644 --- a/controller/Users.py +++ b/controller/Users.py @@ -286,10 +286,19 @@ class Users( object ): ) return + # in addition to this user's own notebooks, add to that list the anonymous user's notebooks + if user_id: + self.__database.load( u"User anonymous", self.__scheduler.thread ) + anonymous = ( yield Scheduler.SLEEP ) + notebooks = anonymous.notebooks + else: + notebooks = [] + notebooks += user.notebooks + yield dict( user = user, - notebooks = user.notebooks, - startup_notes = include_startup_notes and len( user.notebooks ) > 0 and user.notebooks[ 0 ].startup_notes or [], + notebooks = notebooks, + startup_notes = include_startup_notes and len( notebooks ) > 0 and notebooks[ 0 ].startup_notes or [], http_url = self.__http_url, ) diff --git a/controller/test/Test_users.py b/controller/test/Test_users.py index 21e2b64..cd80550 100644 --- a/controller/test/Test_users.py +++ b/controller/test/Test_users.py @@ -37,16 +37,10 @@ class Test_users( Test_controller ): self.database.next_id( self.scheduler.thread ) self.anon_notebook = Notebook( ( yield Scheduler.SLEEP ), u"anon notebook" ) - self.database.next_id( self.scheduler.thread ) - self.anon_startup_note = Note( ( yield Scheduler.SLEEP ), u"contents go here" ) - self.anon_notebook.add_note( self.anon_startup_note ) - self.anon_notebook.add_startup_note( self.anon_startup_note ) - - self.database.next_id( self.scheduler.thread ) - self.startup_note = Note( ( yield Scheduler.SLEEP ), u"other contents go here" ) - self.notebooks[ 0 ].add_note( self.startup_note ) - self.notebooks[ 0 ].add_startup_note( self.startup_note ) + self.startup_note = Note( ( yield Scheduler.SLEEP ), u"contents go here" ) + self.anon_notebook.add_note( self.startup_note ) + self.anon_notebook.add_startup_note( self.startup_note ) self.database.next_id( self.scheduler.thread ) self.user = User( ( yield Scheduler.SLEEP ), self.username, self.password, self.email_address, self.notebooks ) @@ -87,9 +81,11 @@ class Test_users( Test_controller ): assert result[ u"user" ].username == self.new_username notebooks = result[ u"notebooks" ] - assert len( notebooks ) == 1 + assert len( notebooks ) == 2 + assert notebooks[ 0 ] == self.anon_notebook + assert notebooks[ 0 ].trash == None - notebook = notebooks[ 0 ] + notebook = notebooks[ 1 ] assert notebook.object_id == new_notebook_id assert notebook.trash assert len( notebook.notes ) == 1 @@ -98,7 +94,7 @@ class Test_users( Test_controller ): startup_notes = result[ "startup_notes" ] if include_startup_notes: assert len( startup_notes ) == 1 - assert u"welcome to your wiki" in startup_notes[ 0 ].contents + assert startup_notes[ 0 ] == self.startup_note else: assert startup_notes == [] @@ -166,7 +162,7 @@ class Test_users( Test_controller ): ) assert result[ u"user" ] == self.user - assert result[ u"notebooks" ] == self.notebooks + assert result[ u"notebooks" ] == [ self.anon_notebook ] + self.notebooks assert result[ u"http_url" ] == self.settings[ u"global" ].get( u"luminotes.http_url" ) startup_notes = result[ "startup_notes" ] @@ -191,7 +187,7 @@ class Test_users( Test_controller ): startup_notes = result[ "startup_notes" ] if include_startup_notes: assert len( startup_notes ) == 1 - assert startup_notes[ 0 ] == self.anon_startup_note + assert startup_notes[ 0 ] == self.startup_note else: assert startup_notes == [] diff --git a/static/js/Wiki.js b/static/js/Wiki.js index 32d8d27..75e6135 100644 --- a/static/js/Wiki.js +++ b/static/js/Wiki.js @@ -62,6 +62,9 @@ Wiki.prototype.display_user = function ( result ) { for ( var i in result.notebooks ) { var notebook = result.notebooks[ i ]; + if ( notebook.name == "Luminotes" ) + continue; + var div_class = "link_area_item"; if ( notebook.object_id == this.notebook_id ) div_class += " current_notebook_name";