From 449f4835026075d95abae121215cbc4b3f916f9a Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Wed, 22 Sep 2021 17:23:57 +0200 Subject: [PATCH] fds --- files/classes/user.py | 1 - files/routes/admin.py | 6 ++---- files/routes/front.py | 6 ++++-- files/templates/ban_modal.html | 2 +- files/templates/log.html | 20 ++++++++++++++++++++ files/templates/userpage.html | 8 ++++---- 6 files changed, 31 insertions(+), 12 deletions(-) diff --git a/files/classes/user.py b/files/classes/user.py index db855e5059..976704d793 100644 --- a/files/classes/user.py +++ b/files/classes/user.py @@ -516,7 +516,6 @@ class User(Base): if days > 0: ban_time = int(time.time()) + (days * 86400) self.unban_utc = ban_time - else: self.bannerurl = None self.profileurl = None diff --git a/files/routes/admin.py b/files/routes/admin.py index 25f25f0838..2087e82ee3 100644 --- a/files/routes/admin.py +++ b/files/routes/admin.py @@ -861,17 +861,15 @@ def ban_user(user_id, v): # check for number of days for suspension if 'form' in request.values: - days = int(request.values.get("days")) if request.values.get('days') else 0 + days = request.values.get("days", 0) reason = sanitize(request.values.get("reason", "")) message = request.values.get("reason", "") else: - days = int(request.values.get("days")) if request.values.get('days') else 0 + days = request.values.get("days", 0) reason = sanitize(request.values.get("reason", "")) message = request.values.get("reason", "") if not user: abort(400) - - #if user.admin_level > 0: abort(403) if days > 0: if message: diff --git a/files/routes/front.py b/files/routes/front.py index 6e3a82fe9d..1d6a5bcfd8 100644 --- a/files/routes/front.py +++ b/files/routes/front.py @@ -114,8 +114,10 @@ def frontlist(v=None, sort="hot", page=1, t="all", ids_only=True, filter_words=' posts = g.db.query(Submission).options(lazyload('*')) - if t != 'all': - cutoff = 0 + if t != 'day' and sort in ["hot","controversial"]: + cutoff = int(time.time()) - 86400 + posts = posts.filter(Submission.created_utc >= cutoff) + elif t != 'all': now = int(time.time()) if t == 'hour': cutoff = now - 3600 diff --git a/files/templates/ban_modal.html b/files/templates/ban_modal.html index c4112c7fc1..c420645ad9 100644 --- a/files/templates/ban_modal.html +++ b/files/templates/ban_modal.html @@ -18,7 +18,7 @@ - +
diff --git a/files/templates/log.html b/files/templates/log.html index ed8710886f..91f7ef6d20 100644 --- a/files/templates/log.html +++ b/files/templates/log.html @@ -14,6 +14,26 @@ {% endblock %} {% block content %} + + + +
diff --git a/files/templates/userpage.html b/files/templates/userpage.html index 8543496e91..1477124121 100644 --- a/files/templates/userpage.html +++ b/files/templates/userpage.html @@ -299,7 +299,7 @@
- +
@@ -312,7 +312,7 @@ - + @@ -574,7 +574,7 @@
- +
@@ -589,7 +589,7 @@ - +