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 @@ - +