From b121c13d4e14e6a98fb8f8e22060b700e77a5823 Mon Sep 17 00:00:00 2001 From: freamon Date: Sun, 17 Mar 2024 07:28:03 +0000 Subject: [PATCH] post_layout: always show or always hide (for low-bandwidth) --- app/community/routes.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/app/community/routes.py b/app/community/routes.py index f7f61d94..2284912c 100644 --- a/app/community/routes.py +++ b/app/community/routes.py @@ -121,7 +121,13 @@ def show_community(community: Community): page = request.args.get('page', 1, type=int) sort = request.args.get('sort', '' if current_user.is_anonymous else current_user.default_sort) low_bandwidth = request.cookies.get('low_bandwidth', '0') == '1' - post_layout = request.args.get('layout', community.default_layout if not low_bandwidth else None) + if low_bandwidth: + post_layout = None + else: + if community.default_layout is not None: + post_layout = request.args.get('layout', community.default_layout) + else: + post_layout = request.args.get('layout', 'list') # If nothing has changed since their last visit, return HTTP 304 current_etag = f"{community.id}{sort}{post_layout}_{hash(community.last_active)}"