diff --git a/NEWS b/NEWS index 9162caf..3e94dd2 100644 --- a/NEWS +++ b/NEWS @@ -1,6 +1,9 @@ 1.6.9: ? * Added a remove formatting feature to the tools menu. This allows you to strip out all formatting from the currently selected text. + * Luminotes Discussion forums now change the discussion thread link color + based on whether there are any new posts since you last visited the + thread. This makes it much easier to keep up with a particular discussion. * Fixed a bug in which the filename of an exported HTML file was just "export" instead of being based on the notebook name. diff --git a/controller/Forums.py b/controller/Forums.py index c9f47c5..980e432 100644 --- a/controller/Forums.py +++ b/controller/Forums.py @@ -169,9 +169,10 @@ class Forum( object ): start = Valid_int( min = 0 ), count = Valid_int( min = 1, max = 50 ), note_id = Valid_id( none_okay = True ), + posts = Valid_int(), user_id = Valid_id( none_okay = True ), ) - def default( self, thread_id, start = 0, count = 10, note_id = None, user_id = None ): + def default( self, thread_id, start = 0, count = 10, note_id = None, posts = None, user_id = None ): """ Provide the information necessary to display a forum thread. @@ -183,6 +184,10 @@ class Forum( object ): @param count: number of recent notes to display (defaults to 10 notes) @type note_id: unicode or NoneType @param note_id: id of single note to load (optional) + @type posts: integer or NoneType + @param posts: ignored. used for link-visitedness purposes on the client side + @type user_id: unicode or NoneType + @param user_id: id of the current user @rtype: unicode @return: rendered HTML page @raise Validation_error: one of the arguments is invalid diff --git a/controller/test/Test_forums.py b/controller/test/Test_forums.py index 098d473..a52b5cc 100644 --- a/controller/test/Test_forums.py +++ b/controller/test/Test_forums.py @@ -268,6 +268,28 @@ class Test_forums( Test_controller ): user = self.database.load( User, self.user.object_id ) assert user.storage_bytes == 0 + def test_general_thread_default_with_posts( self ): + result = self.http_get( "/forums/general/%s?posts=20" % self.general_thread.object_id ) + + assert result.get( u"user" ).object_id == self.anonymous.object_id + assert len( result.get( u"notebooks" ) ) == 4 + assert result.get( u"notebooks" )[ 0 ].object_id == self.anon_notebook.object_id + assert result.get( u"login_url" ) + assert result.get( u"logout_url" ) + assert result.get( u"rate_plan" ) + assert result.get( u"notebook" ).object_id == self.general_thread.object_id + assert len( result.get( u"startup_notes" ) ) == 0 + assert result.get( u"notes" ) == [] + assert result.get( u"parent_id" ) == None + assert result.get( u"note_read_write" ) in ( None, True ) + assert result.get( u"total_notes_count" ) == 0 + + invites = result[ "invites" ] + assert len( invites ) == 0 + + user = self.database.load( User, self.user.object_id ) + assert user.storage_bytes == 0 + def test_general_thread_default_with_unknown_note_id( self ): result = self.http_get( "/forums/general/%s?note_id=unknownid" % self.general_thread.object_id ) diff --git a/static/css/product.css b/static/css/product.css index 3469746..db74145 100644 --- a/static/css/product.css +++ b/static/css/product.css @@ -277,6 +277,10 @@ form { line-height: 200%; } +.forum_threads a:visited { + color: purple; +} + .forum_title { font-weight: bold; font-size: 105%; diff --git a/view/Forum_page.py b/view/Forum_page.py index d1320b1..4177114 100644 --- a/view/Forum_page.py +++ b/view/Forum_page.py @@ -49,7 +49,9 @@ class Forum_page( Product_page ): [ Div( A( thread.name, - href = os.path.join( base_path, ( forum_name == u"blog" ) and thread.friendly_id or thread.object_id ), + href = ( forum_name == u"blog" ) and \ + os.path.join( base_path, thread.friendly_id ) or \ + "%s?posts=%s" % ( os.path.join( base_path, thread.object_id ), thread.note_count ), ), Span( self.post_count( thread, forum_name ),