Browse Source

Luminotes Discussion forums now change the discussion thread link color based on whether there are any new posts since you last visited the thread.

Dan Helfman 9 years ago
parent
commit
fe99862dde
5 changed files with 38 additions and 2 deletions
  1. 3
    0
      NEWS
  2. 6
    1
      controller/Forums.py
  3. 22
    0
      controller/test/Test_forums.py
  4. 4
    0
      static/css/product.css
  5. 3
    1
      view/Forum_page.py

+ 3
- 0
NEWS View File

@@ -1,6 +1,9 @@
1 1
 1.6.9: ?
2 2
  * Added a remove formatting feature to the tools menu. This allows you to
3 3
    strip out all formatting from the currently selected text.
4
+ * Luminotes Discussion forums now change the discussion thread link color
5
+   based on whether there are any new posts since you last visited the
6
+   thread. This makes it much easier to keep up with a particular discussion.
4 7
  * Fixed a bug in which the filename of an exported HTML file was just
5 8
    "export" instead of being based on the notebook name.
6 9
 

+ 6
- 1
controller/Forums.py View File

@@ -169,9 +169,10 @@ class Forum( object ):
169 169
     start = Valid_int( min = 0 ),
170 170
     count = Valid_int( min = 1, max = 50 ),
171 171
     note_id = Valid_id( none_okay = True ),
172
+    posts = Valid_int(),
172 173
     user_id = Valid_id( none_okay = True ),
173 174
   )
174
-  def default( self, thread_id, start = 0, count = 10, note_id = None, user_id = None ):
175
+  def default( self, thread_id, start = 0, count = 10, note_id = None, posts = None, user_id = None ):
175 176
     """
176 177
     Provide the information necessary to display a forum thread.
177 178
 
@@ -183,6 +184,10 @@ class Forum( object ):
183 184
     @param count: number of recent notes to display (defaults to 10 notes)
184 185
     @type note_id: unicode or NoneType
185 186
     @param note_id: id of single note to load (optional)
187
+    @type posts: integer or NoneType
188
+    @param posts: ignored. used for link-visitedness purposes on the client side
189
+    @type user_id: unicode or NoneType
190
+    @param user_id: id of the current user
186 191
     @rtype: unicode
187 192
     @return: rendered HTML page
188 193
     @raise Validation_error: one of the arguments is invalid

+ 22
- 0
controller/test/Test_forums.py View File

@@ -268,6 +268,28 @@ class Test_forums( Test_controller ):
268 268
     user = self.database.load( User, self.user.object_id )
269 269
     assert user.storage_bytes == 0
270 270
 
271
+  def test_general_thread_default_with_posts( self ):
272
+    result = self.http_get( "/forums/general/%s?posts=20" % self.general_thread.object_id )
273
+
274
+    assert result.get( u"user" ).object_id == self.anonymous.object_id
275
+    assert len( result.get( u"notebooks" ) ) == 4
276
+    assert result.get( u"notebooks" )[ 0 ].object_id == self.anon_notebook.object_id
277
+    assert result.get( u"login_url" )
278
+    assert result.get( u"logout_url" )
279
+    assert result.get( u"rate_plan" )
280
+    assert result.get( u"notebook" ).object_id == self.general_thread.object_id
281
+    assert len( result.get( u"startup_notes" ) ) == 0
282
+    assert result.get( u"notes" ) == []
283
+    assert result.get( u"parent_id" ) == None
284
+    assert result.get( u"note_read_write" ) in ( None, True )
285
+    assert result.get( u"total_notes_count" ) == 0
286
+
287
+    invites = result[ "invites" ]
288
+    assert len( invites ) == 0
289
+
290
+    user = self.database.load( User, self.user.object_id )
291
+    assert user.storage_bytes == 0
292
+
271 293
   def test_general_thread_default_with_unknown_note_id( self ):
272 294
     result = self.http_get( "/forums/general/%s?note_id=unknownid" % self.general_thread.object_id )
273 295
 

+ 4
- 0
static/css/product.css View File

@@ -277,6 +277,10 @@ form {
277 277
   line-height: 200%;
278 278
 }
279 279
 
280
+.forum_threads a:visited {
281
+  color: purple;
282
+}
283
+
280 284
 .forum_title {
281 285
   font-weight: bold;
282 286
   font-size: 105%;

+ 3
- 1
view/Forum_page.py View File

@@ -49,7 +49,9 @@ class Forum_page( Product_page ):
49 49
         [ Div(
50 50
           A(
51 51
             thread.name,
52
-            href = os.path.join( base_path, ( forum_name == u"blog" ) and thread.friendly_id or thread.object_id ),
52
+            href = ( forum_name == u"blog" ) and \
53
+              os.path.join( base_path, thread.friendly_id ) or \
54
+              "%s?posts=%s" % ( os.path.join( base_path, thread.object_id ), thread.note_count ),
53 55
           ),
54 56
           Span(
55 57
             self.post_count( thread, forum_name ),