forked from rDrama/rDrama
1
0
Fork 0
master
Aevann1 2021-08-08 01:23:10 +02:00
parent b3397930b3
commit 53390f7b2d
1 changed files with 10 additions and 9 deletions

View File

@ -53,21 +53,22 @@ def post_pid_comment_cid(cid, pid=None, anything=None, v=None):
if request.headers.get("Authorization"): return {'error': f'This content is not suitable for some users and situations.'} if request.headers.get("Authorization"): return {'error': f'This content is not suitable for some users and situations.'}
else: render_template("errors/nsfw.html", v=v) else: render_template("errors/nsfw.html", v=v)
post.preloaded_comments = [comment] post._preloaded_comments = [comment]
# context improver # context improver
try: context = int(request.args.get("context", 0)) try: context = int(request.args.get("context", 0))
except: context = 0 except: context = 0
comment_info = comment comment_info = comment
while context > 0 and comment.level > 1: c = comment
while context > 0 and c.level > 1:
parent = get_comment(comment.parent_comment_id, v=v) parent = get_comment(c.parent_comment_id, v=v)
post.preloaded_comments += [parent] post._preloaded_comments += [parent]
comment = parent c = parent
context -= 1 context -= 1
top_comment = comment top_comment = c
if v: defaultsortingcomments = v.defaultsortingcomments if v: defaultsortingcomments = v.defaultsortingcomments
else: defaultsortingcomments = "top" else: defaultsortingcomments = "top"
@ -132,7 +133,7 @@ def post_pid_comment_cid(cid, pid=None, anything=None, v=None):
for c in comments: for c in comments:
comment = c[0] comment = c[0]
if comment.author and comment.author.shadowbanned and not (v and v.id == comment.author_id): continue if comment.author and comment.author.shadowbanned and not (v and v.id == comment.author_id): continue
comment.voted = c[1] or 0 comment._voted = c[1] or 0
comment._is_blocking = c[2] or 0 comment._is_blocking = c[2] or 0
comment._is_blocked = c[3] or 0 comment._is_blocked = c[3] or 0
output.append(comment) output.append(comment)
@ -163,7 +164,7 @@ def post_pid_comment_cid(cid, pid=None, anything=None, v=None):
abort(422) abort(422)
post.preloaded_comments += output post._preloaded_comments += output
current_ids = [x.id for x in output] current_ids = [x.id for x in output]
@ -877,4 +878,4 @@ def unsave_comment(cid, v):
g.db.delete(save) g.db.delete(save)
return "", 204 return "", 204