Merge remote-tracking branch 'origin/master'

# Conflicts:
#	files/classes/submission.py
#	files/routes/posts.py
remotes/1693045480750635534/spooky-22
fireworks88 2021-09-05 14:03:25 +02:00
commit a650ca65a5
3 changed files with 8 additions and 10 deletions

View File

@ -134,7 +134,7 @@ class Submission(Base, Stndrd, Age_times, Scores, Fuzzing):
return f"/post/{self.id}/{output}"
def rendered_page(self, sort=None, comment=None, read=None, comment_info=None, v=None):
def rendered_page(self, read=None, sort=None, comment=None, comment_info=None, v=None):
# check for banned
if v and (v.admin_level >= 3 or self.author_id == v.id):

View File

@ -181,11 +181,11 @@ def post_id(pid, anything=None, v=None):
post.preloaded_comments = [x for x in comments if not (x.author and x.author.shadowbanned) or (v and v.id == x.author_id)]
read = session["read_comments"]
read_comments = [x.id for x in post.preloaded_comments]
if session.get("read_comments"): session["read_comments"] += read_comments
else: session["read_comments"] = read_comments
read = session.get("read_comments")
read_comments = [x.id for x in post.preloaded_comments]
if session.get("read_comments"): session["read_comments"] += read_comments
else: session["read_comments"] = read_comments
print(session.get("read_comments"))
post.views += 1
g.db.add(post)
@ -194,11 +194,9 @@ def post_id(pid, anything=None, v=None):
if request.headers.get("Authorization"): return {"error":"Must be 18+ to view"}, 451
else: return render_template("errors/nsfw.html", v=v)
post.tree_comments()
if request.headers.get("Authorization"): return post.json
else: return post.rendered_page(v=v, read=None, sort=sort)
else: return post.rendered_page(v=v, read=read, sort=sort)
@app.post("/edit_post/<pid>")

View File

@ -111,7 +111,7 @@
<div class="comment-body">
<div id="{% if comment_info and comment_info.id == c.id %}context{%else%}comment-{{c.id}}-only{% endif %}" class="{% if comment_info and comment_info.id == c.id %}context{%endif%}{% if c.is_banned %} banned{% endif %}{% if c.deleted_utc %} deleted{% endif %}" {% if read and c.id not in read %}style="background-color: rgba(179,229,255,0.5)"{% endif %}>
<div id="{% if comment_info and comment_info.id == c.id %}context{%else%}comment-{{c.id}}-only{% endif %}" class="{% if comment_info and comment_info.id == c.id %}context{%endif%}{% if c.is_banned %} banned{% endif %}{% if c.deleted_utc %} deleted{% endif %}" {% if read %}style="background-color: rgba(179,229,255,0.5)"{% endif %}>
<div class="user-info">
<span class="comment-collapse d-md-none" onclick="collapse_comment('{{c.id}}')"></span>