From dfe5fdcea17a18112c5baf15abd7446c7e3b89d6 Mon Sep 17 00:00:00 2001 From: Aevann Date: Fri, 12 May 2023 22:40:34 +0300 Subject: [PATCH] make logged_out-cels count towards post view counts again --- files/routes/posts.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/files/routes/posts.py b/files/routes/posts.py index 243b0799f..b3eee0357 100644 --- a/files/routes/posts.py +++ b/files/routes/posts.py @@ -95,6 +95,9 @@ def post_id(pid, anything=None, v=None, sub=None): if g.is_api_or_xhr: abort(451, "Must be 18+ to view") return render_template("errors/nsfw.html", v=v) + p.views += 1 + g.db.add(p) + if not v and not request.values.get("sort"): result = cache.get(f'post_{p.id}') if result: return result @@ -166,9 +169,6 @@ def post_id(pid, anything=None, v=None, sub=None): p.replies = list(pinned2.keys()) + comments - p.views += 1 - g.db.add(p) - if v and v.client: return p.json(g.db)