mirror of
https://codeberg.org/rimu/pyfedi
synced 2025-01-23 19:36:56 -08:00
post_layout: always show or always hide (for low-bandwidth)
This commit is contained in:
parent
a121b316d5
commit
b121c13d4e
1 changed files with 7 additions and 1 deletions
|
@ -121,7 +121,13 @@ def show_community(community: Community):
|
||||||
page = request.args.get('page', 1, type=int)
|
page = request.args.get('page', 1, type=int)
|
||||||
sort = request.args.get('sort', '' if current_user.is_anonymous else current_user.default_sort)
|
sort = request.args.get('sort', '' if current_user.is_anonymous else current_user.default_sort)
|
||||||
low_bandwidth = request.cookies.get('low_bandwidth', '0') == '1'
|
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
|
# If nothing has changed since their last visit, return HTTP 304
|
||||||
current_etag = f"{community.id}{sort}{post_layout}_{hash(community.last_active)}"
|
current_etag = f"{community.id}{sort}{post_layout}_{hash(community.last_active)}"
|
||||||
|
|
Loading…
Add table
Reference in a new issue