diff --git a/files/routes/front.py b/files/routes/front.py index 4aee992e4b..cfe18fd615 100644 --- a/files/routes/front.py +++ b/files/routes/front.py @@ -208,11 +208,14 @@ def frontlist(v=None, sort="hot", page=1, t="all", ids_only=True, filter_words=' elif sort == "comments": posts = posts.order_by(Submission.comment_count.desc()) - posts = posts.offset(25 * (page - 1)).limit(26).all() + if v: size = v.frontsize + else: size = 25 - next_exists = (len(posts) > 25) + posts = posts.offset(size * (page - 1)).limit(size+1).all() - posts = posts[:25] + next_exists = (len(posts) > size) + + posts = posts[:size] if page == 1: posts = g.db.query(Submission.id).options(lazyload('*')).filter(Submission.stickied != None).all() + posts diff --git a/files/routes/settings.py b/files/routes/settings.py index adb7a75fdb..d05a4c7a80 100644 --- a/files/routes/settings.py +++ b/files/routes/settings.py @@ -169,29 +169,34 @@ def settings_profile_post(v): + frontsize = request.values.get("frontsize") + if frontsize: + if frontsize in ["25", "50", "100"]: + v.frontsize = int(frontsize) + updated = True + cache.delete_memoized(frontlist) + else: abort(400) + defaultsortingcomments = request.values.get("defaultsortingcomments") if defaultsortingcomments: if defaultsortingcomments in ["new", "old", "controversial", "top", "bottom"]: v.defaultsortingcomments = defaultsortingcomments updated = True - else: - abort(400) + else: abort(400) defaultsorting = request.values.get("defaultsorting") if defaultsorting: if defaultsorting in ["hot", "new", "old", "comments", "controversial", "top", "bottom"]: v.defaultsorting = defaultsorting updated = True - else: - abort(400) + else: abort(400) defaulttime = request.values.get("defaulttime") if defaulttime: if defaulttime in ["hour", "day", "week", "month", "year", "all"]: v.defaulttime = defaulttime updated = True - else: - abort(400) + else: abort(400) theme = request.values.get("theme") if theme: diff --git a/files/templates/oauth.html b/files/templates/oauth.html index 11fa9d20d2..ac93dee3ae 100644 --- a/files/templates/oauth.html +++ b/files/templates/oauth.html @@ -23,7 +23,7 @@

It will not be able to see your password, or change your account settings.

-
+ diff --git a/files/templates/settings_filters.html b/files/templates/settings_filters.html index deb4c1fdd6..4e92368fc1 100644 --- a/files/templates/settings_filters.html +++ b/files/templates/settings_filters.html @@ -11,6 +11,30 @@
+

Frontpage Size

+ +
+
+
+ +
+ +
+

Change how many posts appear on every page.

+
+ +
+ +
+ +
+
+ +

Default Sorting and Time Filter