remotes/1693045480750635534/spooky-22
BuckFromRdrama 2022-01-31 16:32:11 -05:00 committed by GitHub
parent f03c4dc38a
commit 8704c83ef8
2 changed files with 19 additions and 1 deletions

View File

@ -173,11 +173,13 @@ def front_all(v):
sort=request.values.get("sort", defaultsorting)
t=request.values.get('t', defaulttime)
ccmode=request.values.get('ccmode', "false")
ids, next_exists = frontlist(sort=sort,
page=page,
t=t,
v=v,
ccmode=ccmode,
filter_words=v.filter_words if v else [],
gt=int(request.values.get("utc_greater_than", 0)),
lt=int(request.values.get("utc_less_than", 0)),
@ -266,7 +268,7 @@ def front_all(v):
@cache.memoize(timeout=86400)
def frontlist(v=None, sort="hot", page=1, t="all", ids_only=True, filter_words='', gt=None, lt=None):
def frontlist(v=None, sort="hot", page=1, t="all", ids_only=True, ccmode="false", filter_words='', gt=None, lt=None):
posts = g.db.query(Submission)
@ -280,6 +282,9 @@ def frontlist(v=None, sort="hot", page=1, t="all", ids_only=True, filter_words='
else: cutoff = now - 86400
posts = posts.filter(Submission.created_utc >= cutoff)
if (ccmode == "true"):
posts = posts.filter(Submission.club == True)
if sort == "hot" or (v and v.id == Q_ID): posts = posts.filter_by(is_banned=False, stickied=None, private=False, deleted_utc = 0)
else: posts = posts.filter_by(is_banned=False, private=False, deleted_utc = 0)

View File

@ -41,6 +41,19 @@
<div class="d-flex align-items-center sortingbarmargin">
<div class="text-small font-weight-bold mr-2"></div>
{% if v.admin_level > 1 or v.club_allowed != False %}
{% set ccmode = request.args.get("ccmode") %}
<div class="toggle-cc-mode">
<button class="btn btn-secondary ccMode-toggle" type="button" id="toggleCCMode">
{% if ccmode=="true"%}<a class="cc-activated" href="?sort={{sort}}&t={{t}}&ccmode=false"><i class="fas fa-angry mr-2"></i>COUNTRY CLUB MODE: ACTIVATED</a>{% endif %}
{% if ccmode=="false" or not ccmode %}<a class="cc-deactivated" href="?sort={{sort}}&t={{t}}&ccmode=true"><i class="fas fa-angry mr-2"></i>CC Mode</a>{% endif %}
</button>
</div>
<div class="text-small font-weight-bold ml-3 mr-2"></div>
{% endif %}
<div class="dropdown dropdown-actions">
<button class="btn btn-secondary dropdown-toggle" type="button" id="dropdownMenuButton" data-bs-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
{% if t=="hour" %}<i class="fas fa-clock mr-1"></i>