forked from rDrama/rDrama
comment_info -> focused_comment
parent
f305077dbe
commit
0b00ee57e7
|
@ -449,12 +449,12 @@ class Comment(Base):
|
|||
return body
|
||||
|
||||
@lazy
|
||||
def collapse_for_user(self, v, comment_info, path=''):
|
||||
def collapse_for_user(self, v, focused_comment, path=''):
|
||||
if v and self.author_id == v.id: return False
|
||||
|
||||
if path == '/admin/removed/comments': return False
|
||||
|
||||
if comment_info: return False
|
||||
if focused_comment: return False
|
||||
|
||||
if self.nsfw and not (any(path.startswith(x) for x in ('/post/','/comment/','/h/')) and self.post.nsfw) and not g.show_nsfw:
|
||||
return True
|
||||
|
|
|
@ -65,7 +65,7 @@ def post_pid_comment_cid(cid, v, pid=None, anything=None, hole=None):
|
|||
|
||||
try: context = min(int(request.values.get("context", 8)), 8)
|
||||
except: context = 8
|
||||
comment_info = comment
|
||||
focused_comment = comment
|
||||
c = comment
|
||||
|
||||
if post.new: defaultsortingcomments = 'new'
|
||||
|
@ -95,7 +95,7 @@ def post_pid_comment_cid(cid, v, pid=None, anything=None, hole=None):
|
|||
else:
|
||||
if post.is_banned and not (v and (v.admin_level >= PERMS['POST_COMMENT_MODERATION'] or post.author_id == v.id)): template = "post_banned.html"
|
||||
else: template = "post.html"
|
||||
return render_template(template, v=v, p=post, sort=sort, comment_info=comment_info, render_replies=True, hole=post.hole_obj)
|
||||
return render_template(template, v=v, p=post, sort=sort, focused_comment=focused_comment, render_replies=True, hole=post.hole_obj)
|
||||
|
||||
@app.post("/comment")
|
||||
@limiter.limit('1/second', scope=rpath)
|
||||
|
|
|
@ -908,7 +908,7 @@ def u_username_wall_comment(v, username, cid):
|
|||
|
||||
try: context = min(int(request.values.get("context", 8)), 8)
|
||||
except: context = 8
|
||||
comment_info = comment
|
||||
focused_comment = comment
|
||||
c = comment
|
||||
while context and c.level > 1:
|
||||
c = c.parent_comment
|
||||
|
@ -922,7 +922,7 @@ def u_username_wall_comment(v, username, cid):
|
|||
|
||||
if v and v.client: return top_comment.json
|
||||
|
||||
return render_template("userpage/wall.html", u=u, v=v, listing=[top_comment], page=1, is_following=is_following, standalone=True, render_replies=True, wall=True, comment_info=comment_info, total=1)
|
||||
return render_template("userpage/wall.html", u=u, v=v, listing=[top_comment], page=1, is_following=is_following, standalone=True, render_replies=True, wall=True, focused_comment=focused_comment, total=1)
|
||||
|
||||
@app.get("/@<username>/posts")
|
||||
@limiter.limit(DEFAULT_RATELIMIT, deduct_when=lambda response: response.status_code < 400)
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
{%- import 'util/macros.html' as macros with context -%}
|
||||
{% if not request.headers.get("xhr") %}
|
||||
{% if comment_info %}
|
||||
<script defer src="{{'js/comment_info.js' | asset}}"></script>
|
||||
{% if focused_comment %}
|
||||
<script defer src="{{'js/focused_comment.js' | asset}}"></script>
|
||||
{% endif %}
|
||||
|
||||
{% if v %}
|
||||
|
@ -24,7 +24,7 @@
|
|||
{% endif %}
|
||||
|
||||
{% if (c.is_banned or c.deleted_utc) and not (v and v.admin_level >= PERMS['POST_COMMENT_MODERATION']) and not (v and v.id == c.author_id) %}
|
||||
<div id="comment-{{c.id}}" class="comment {% if not (v and v.id == author_id) and not (v and v.admin_level) and not comment_info %}collapsed{% endif %}">
|
||||
<div id="comment-{{c.id}}" class="comment {% if not (v and v.id == author_id) and not (v and v.admin_level) and not focused_comment %}collapsed{% endif %}">
|
||||
<span class="comment-collapse-line" style="border-color: #{{c.author.name_color}}" data-nonce="{{g.nonce}}" data-onclick="collapse_comment('{{c.id}}')"></span>
|
||||
<div class="comment-body">
|
||||
<div id="comment-{{c.id}}-only" class="comment-{{c.id}}-only">
|
||||
|
@ -127,12 +127,12 @@
|
|||
{% set isreply = False %}
|
||||
{% endif %}
|
||||
|
||||
<div id="comment-{{c.id}}" class="anchor comment {% if wall and level == 1 and not (comment_info and c == comment_info) %}mt-5{% elif wall %}mt-4{% elif standalone and level == 1 %}mt-0{% endif %} {% if collapse or c.collapse_for_user(v, comment_info, request.full_path) %}collapsed{% endif %}" style="{% if isreply %}padding-left:0!important{% endif %}">
|
||||
<div id="comment-{{c.id}}" class="anchor comment {% if wall and level == 1 and not (focused_comment and c == focused_comment) %}mt-5{% elif wall %}mt-4{% elif standalone and level == 1 %}mt-0{% endif %} {% if collapse or c.collapse_for_user(v, focused_comment, request.full_path) %}collapsed{% endif %}" style="{% if isreply %}padding-left:0!important{% endif %}">
|
||||
{% if not isreply %}
|
||||
<span class="comment-collapse-line" style="border-color: {% if c.ghost %}var(--primary){% else %}#{{c.author.name_color}}{% endif %}" data-nonce="{{g.nonce}}" data-onclick="collapse_comment('{{c.id}}')"></span>
|
||||
{% endif %}
|
||||
<div class="comment-body">
|
||||
<div id="{% if comment_info and comment_info.id == c.id %}context{% else %}comment-{{c.id}}-only{% endif %}" class="{% if c.unread %}unread{% endif %} comment-{{c.id}}-only comment-anchor {% if comment_info and comment_info.id == c.id %}context{% endif %}{% if c.is_banned %} banned{% endif %}{% if c.deleted_utc %} deleted{% endif %}">
|
||||
<div id="{% if focused_comment and focused_comment.id == c.id %}context{% else %}comment-{{c.id}}-only{% endif %}" class="{% if c.unread %}unread{% endif %} comment-{{c.id}}-only comment-anchor {% if focused_comment and focused_comment.id == c.id %}context{% endif %}{% if c.is_banned %} banned{% endif %}{% if c.deleted_utc %} deleted{% endif %}">
|
||||
<div class="user-info">
|
||||
<span class="comment-collapse-icon" data-nonce="{{g.nonce}}" data-onclick="collapse_comment('{{c.id}}')"></span>
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
{% extends "default.html" %}
|
||||
{% block pagetitle %}
|
||||
{%- if comment_info -%}
|
||||
@{{comment_info.author_name}}'s comment on '{{p.plaintitle(v)}}'
|
||||
{%- if focused_comment -%}
|
||||
@{{focused_comment.author_name}}'s comment on '{{p.plaintitle(v)}}'
|
||||
{%- else -%}
|
||||
{{p.plaintitle(v)}}
|
||||
{%- endif -%}
|
||||
|
@ -318,7 +318,7 @@
|
|||
|
||||
{{macros.comment_reply_box(p.fullname, 'comment-reply-' + p.fullname, subwrapper_css_classes='mb-3', enable_cancel_button=false)}}
|
||||
|
||||
{% if comment_info %}
|
||||
{% if focused_comment %}
|
||||
<div class="total mt-1"><a href="{{p.permalink}}">View entire discussion <i class="fas fa-long-arrow-right ml-1"></i></a></div>
|
||||
{% endif %}
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
<div class="userpage-wall">
|
||||
{{macros.comment_reply_box(u.fullname, 'replying-to-' + u.fullname, '', 'mb-3 mt-4', '', enable_cancel_button=false)}}
|
||||
|
||||
{% if comment_info %}
|
||||
{% if focused_comment %}
|
||||
<div class="total mt-1"><a href="/@{{u.username}}">View entire wall <i class="fas fa-long-arrow-right ml-1"></i></a></div>
|
||||
{% endif %}
|
||||
|
||||
|
|
|
@ -23,8 +23,8 @@
|
|||
{% set audio = p.realurl(v) if p.is_audio %}
|
||||
{% endif %}
|
||||
|
||||
{% if comment_info and not comment_info.is_banned and not comment_info.deleted_utc %}
|
||||
{% set p, title = comment_info, ['@', comment_info.author_name, "'s comment on ",
|
||||
{% if focused_comment and not focused_comment.is_banned and not focused_comment.deleted_utc %}
|
||||
{% set p, title = focused_comment, ['@', focused_comment.author_name, "'s comment on ",
|
||||
'"', title, '"'] | join %}
|
||||
{% endif %}
|
||||
|
||||
|
@ -76,7 +76,7 @@
|
|||
<meta property="og:author" name="author" content="{{author | default(SITE_FULL, true)}}">
|
||||
<meta property="og:description" name="description" content="{{description | default(SITE_NAME ~ ' - ' ~ DESCRIPTION)}}">
|
||||
|
||||
{% if not comment_info %}
|
||||
{% if not focused_comment %}
|
||||
<meta property="og:image" content="{{image | default('site_preview.webp' | asset_siteimg)}}">
|
||||
{% if video %}<meta property="og:video" content="{{video}}">{% endif %}
|
||||
{% if audio %}<meta property="og:audio" content="{{audio}}">{% endif %}
|
||||
|
|
Loading…
Reference in New Issue