Fix: Datetime behavioral issues.

This commit is contained in:
Ben Rog-Wilhelm 2023-06-17 04:41:51 -05:00
parent bd909f394d
commit c610c60dc0
4 changed files with 9 additions and 6 deletions

View file

@ -7,6 +7,7 @@ from files.helpers.media import process_image
from files.helpers.wrappers import *
from files.routes.importstar import *
from datetime import datetime, timezone
@app.get("/comment/<cid>")
@app.get("/post/<pid>/<anything>/<cid>")
@ -334,7 +335,7 @@ def delete_comment(cid, v):
c = get_comment(cid, v=v)
if c.state_user_deleted_utc: abort(409)
if c.author_id != v.id: abort(403)
c.state_user_deleted_utc = time.time()
c.state_user_deleted_utc = datetime.now(tz=timezone.utc)
# TODO: update stateful counters
g.db.add(c)
g.db.commit()