Allow user to set whether comments are ascending or descending
authorChristopher Allan Webber <cwebber@dustycloud.org>
Sat, 19 Nov 2011 20:01:38 +0000 (14:01 -0600)
committerChristopher Allan Webber <cwebber@dustycloud.org>
Sat, 19 Nov 2011 20:01:38 +0000 (14:01 -0600)
mediagoblin/config_spec.ini
mediagoblin/user_pages/views.py

index 900957cee4b23b3741659c5bc256b06142a1e881..4d41234686c490a5321ec211a76f9ff76cf82ce5 100644 (file)
@@ -27,6 +27,9 @@ allow_registration = boolean(default=True)
 tags_delimiter = string(default=",")
 tags_max_length = integer(default=50)
 
+# Whether comments are ascending or descending
+comments_ascending = boolean(default=True)
+
 # By default not set, but you might want something like:
 # "%(here)s/user_dev/templates/"
 local_templates = string()
index 98a21bb45a51c631515e6dfa2c2e69e6cf65bc9b..25fd2ebb0f4ef4a4e6d1bf6aabb63a774af1ef65 100644 (file)
@@ -106,11 +106,15 @@ def media_home(request, media, page, **kwargs):
     """
     if ObjectId(request.matchdict.get('comment')):
         pagination = Pagination(
-            page, media.get_comments(True), MEDIA_COMMENTS_PER_PAGE,
+            page, media.get_comments(
+                mg_globals.app_config['comments_ascending']),
+            MEDIA_COMMENTS_PER_PAGE,
             ObjectId(request.matchdict.get('comment')))
     else:
         pagination = Pagination(
-            page, media.get_comments(True), MEDIA_COMMENTS_PER_PAGE)
+            page, media.get_comments(
+                mg_globals.app_config['comments_ascending']),
+            MEDIA_COMMENTS_PER_PAGE)
 
     comments = pagination()