forked from MarseyWorld/MarseyWorld
gfd
parent
e65f6d51d1
commit
44c28c9416
|
@ -181,7 +181,7 @@ class Submission(Base):
|
||||||
return f"/post/{self.id}/{output}"
|
return f"/post/{self.id}/{output}"
|
||||||
|
|
||||||
@lazy
|
@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"
|
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"
|
else: template = "submission.html"
|
||||||
|
@ -191,7 +191,6 @@ class Submission(Base):
|
||||||
return render_template(template,
|
return render_template(template,
|
||||||
v=v,
|
v=v,
|
||||||
p=self,
|
p=self,
|
||||||
last_view_utc=last_view_utc,
|
|
||||||
sort=sort,
|
sort=sort,
|
||||||
linked_comment=comment,
|
linked_comment=comment,
|
||||||
comment_info=comment_info,
|
comment_info=comment_info,
|
||||||
|
|
|
@ -177,17 +177,6 @@ def post_id(pid, anything=None, v=None):
|
||||||
|
|
||||||
post.preloaded_comments = comments.all()
|
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
|
post.views += 1
|
||||||
g.db.add(post)
|
g.db.add(post)
|
||||||
|
@ -198,8 +187,6 @@ def post_id(pid, anything=None, v=None):
|
||||||
|
|
||||||
g.db.commit()
|
g.db.commit()
|
||||||
if request.headers.get("Authorization"): return post.json
|
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)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
|
|
||||||
{% if v %}
|
{% if v %}
|
||||||
{% include "award_modal.html" %}
|
{% include "award_modal.html" %}
|
||||||
<script src="/assets/js/comments_v.js"></script>
|
<script src="/assets/js/comments_v2.js"></script>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
<script src="https://cdn.jsdelivr.net/npm/clipboard@2.0.8/dist/clipboard.min.js"></script>
|
<script src="https://cdn.jsdelivr.net/npm/clipboard@2.0.8/dist/clipboard.min.js"></script>
|
||||||
|
@ -171,7 +171,16 @@
|
||||||
<div class="user-info">
|
<div class="user-info">
|
||||||
<span class="comment-collapse d-md-none" onclick="collapse_comment('{{c.id}}')"></span>
|
<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 %}
|
{% if c.awards %}
|
||||||
{% for a in c.awards %}
|
{% for a in c.awards %}
|
||||||
|
|
Loading…
Reference in New Issue