From 44c28c94163d0fbff9831c872c886879a2aeb8db Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Wed, 29 Sep 2021 18:50:52 +0200 Subject: [PATCH] gfd --- files/classes/submission.py | 3 +-- files/routes/posts.py | 15 +-------------- files/templates/comments.html | 13 +++++++++++-- 3 files changed, 13 insertions(+), 18 deletions(-) diff --git a/files/classes/submission.py b/files/classes/submission.py index 99f128d30..6075b5ba7 100644 --- a/files/classes/submission.py +++ b/files/classes/submission.py @@ -181,7 +181,7 @@ class Submission(Base): return f"/post/{self.id}/{output}" @lazy - def rendered_page(self, sort=None, last_view_utc=None, comment=None, comment_info=None, v=None): + def rendered_page(self, sort=None, comment=None, comment_info=None, v=None): if self.is_banned and not (v and (v.admin_level >= 3 or self.author_id == v.id)): template = "submission_banned.html" else: template = "submission.html" @@ -191,7 +191,6 @@ class Submission(Base): return render_template(template, v=v, p=self, - last_view_utc=last_view_utc, sort=sort, linked_comment=comment, comment_info=comment_info, diff --git a/files/routes/posts.py b/files/routes/posts.py index 03b81e69a..af90e76af 100644 --- a/files/routes/posts.py +++ b/files/routes/posts.py @@ -177,17 +177,6 @@ def post_id(pid, anything=None, v=None): post.preloaded_comments = comments.all() - if not v or v.highlightcomments: - last_view_utc = session.get(str(post.id)) - if last_view_utc: last_view_utc = int(last_view_utc) - session[str(post.id)] = int(time.time()) - - keys = [] - for key, val in session.items(): - if type(val) is int and key not in ['login_nonce','user_id']: - if time.time() - val > 86400: keys.append(key) - - for key in keys: session.pop(key) post.views += 1 g.db.add(post) @@ -198,9 +187,7 @@ def post_id(pid, anything=None, v=None): g.db.commit() if request.headers.get("Authorization"): return post.json - else: - if not v or v.highlightcomments: return post.rendered_page(v=v, last_view_utc=last_view_utc, sort=sort) - else: return post.rendered_page(v=v, sort=sort) + else: return post.rendered_page(v=v, sort=sort) @app.post("/edit_post/") diff --git a/files/templates/comments.html b/files/templates/comments.html index d2c0f92d2..ad2943f04 100644 --- a/files/templates/comments.html +++ b/files/templates/comments.html @@ -25,7 +25,7 @@ {% if v %} {% include "award_modal.html" %} - + {% endif %} @@ -171,7 +171,16 @@