Make banned_until not null

This commit is contained in:
David Hoppenbrouwers
2022-10-09 15:47:42 +02:00
parent 8189d429c1
commit 7c55ab7bac
3 changed files with 4 additions and 7 deletions

View File

@@ -422,7 +422,6 @@ def admin_new_forum():
@app.route('/admin/config/edit/', methods = ['POST'])
def admin_edit_config():
print('what')
chk, user = _admin_check()
if not chk:
return user
@@ -534,8 +533,6 @@ class Comment:
self.parent_id = parent_id
def create_comment_tree(comments):
comments = [*comments]
print(comments)
start = time.time();
# Collect comments first, then build the tree in case we encounter a child before a parent
comment_map = {
@@ -576,7 +573,7 @@ class User:
return self.role == Role.ADMIN
def is_banned(self):
return self.banned_until is not None and self.banned_until > time.time_ns()
return self.banned_until > time.time_ns()
def get_user():
id = session.get('user_id')

View File

@@ -14,7 +14,7 @@ create table users (
about text not null default '',
join_time integer not null,
role integer not null default 0,
banned_until integer
banned_until integer not null default 0
);
create table threads (

View File

@@ -99,12 +99,12 @@
</form>
</td>
<td>
{% if banned_until is not none %}
{%- if banned_until > 0 -%}
<form method=post action="user/{{ id }}/unban/">
{{- format_time(banned_until) }}
<input type=submit value=Unban>
</form>
{% endif %}
{%- endif -%}
<form method=post action="user/{{ id }}/ban/">
<input type=number name=days placeholder=days>
<input type=time name=time>