remotes/1693045480750635534/spooky-22
Aevann1 2021-09-29 18:50:52 +02:00
parent e65f6d51d1
commit 44c28c9416
3 changed files with 13 additions and 18 deletions

View File

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

View File

@ -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/<pid>")

View File

@ -25,7 +25,7 @@
{% if v %}
{% include "award_modal.html" %}
<script src="/assets/js/comments_v.js"></script>
<script src="/assets/js/comments_v2.js"></script>
{% endif %}
<script src="https://cdn.jsdelivr.net/npm/clipboard@2.0.8/dist/clipboard.min.js"></script>
@ -171,7 +171,16 @@
<div class="user-info">
<span class="comment-collapse d-md-none" onclick="collapse_comment('{{c.id}}')"></span>
{% if last_view_utc and c.created_utc > last_view_utc and not (v and v.id==c.author_id) and (not v or v.highlightcomments) %}<i style="color:red !important" class="text-admin fas fa-circle" data-bs-toggle="tooltip" data-bs-placement="bottom" title="Unread"></i>{% endif %}
{% if p and not (v and v.id==c.author_id) and (not v or v.highlightcomments) %}
<script>
const comments = JSON.parse(localStorage.getItem(COMMENT_COUNTS_ID)) || {}
const lastCount = comments[postId]
if ({{c.created_utc}} > lastCount.t) {
document.getElementsById("reddot-{{c.id}}").innerHTML = '<i style="color:red !important" class="text-admin fas fa-circle" data-bs-toggle="tooltip" data-bs-placement="bottom" title="Unread"></i>'
}
</script>
<div id="reddot-{{c.id}}"></div>
{% endif %}
{% if c.awards %}
{% for a in c.awards %}