From 7c378f2cd5324a05e709cbada5eb5668ce3a3469 Mon Sep 17 00:00:00 2001 From: Christopher Allan Webber Date: Sat, 19 Nov 2011 14:01:38 -0600 Subject: [PATCH] Allow user to set whether comments are ascending or descending --- mediagoblin/config_spec.ini | 3 +++ mediagoblin/user_pages/views.py | 8 ++++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/mediagoblin/config_spec.ini b/mediagoblin/config_spec.ini index 900957ce..4d412346 100644 --- a/mediagoblin/config_spec.ini +++ b/mediagoblin/config_spec.ini @@ -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() diff --git a/mediagoblin/user_pages/views.py b/mediagoblin/user_pages/views.py index 98a21bb4..25fd2ebb 100644 --- a/mediagoblin/user_pages/views.py +++ b/mediagoblin/user_pages/views.py @@ -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() -- 2.25.1