172 lines
9.8 KiB
Twig
172 lines
9.8 KiB
Twig
{% if not app.user or (app.user and not app.user.isBlocked(comment.user)) %}
|
|
{% if comment.visibility is same as 'private' and (not app.user or not app.user.isFollower(comment.user)) %}
|
|
<div class="section section--small {{ 'comment-level--' ~ this.getLevel() }}"
|
|
style="z-index:3; position:relative;margin-bottom:0;">
|
|
Private
|
|
</div>
|
|
{% else %}
|
|
<blockquote{{ attributes.defaults({
|
|
class: html_classes('section comment entry-comment subject ' ~ 'comment-level--' ~ this.getLevel(),{
|
|
'own': app.user and comment.isAuthor(app.user),
|
|
'author': comment.isAuthor(comment.entry.user),
|
|
})}).without('id') }}
|
|
id="entry-comment-{{ comment.id }}"
|
|
data-controller="comment subject"
|
|
data-subject-parent-value="{{ comment.parent ? comment.parent.id : '' }}"
|
|
data-action="notifications:Notification@window->subject#notification">
|
|
<header>
|
|
{% if comment.isAdult %}<span class="badge danger">+18</span>{% endif %}
|
|
{{ component('user_inline', {user: comment.user, showAvatar: false}) }},
|
|
{% if dateAsUrl %}
|
|
<a href="{{ entry_url(comment.entry) }}#{{ get_url_fragment(comment) }}"
|
|
class="link-muted">{{ component('date', {date: comment.createdAt}) }}</a>
|
|
{% else %}
|
|
{{ component('date', {date: comment.createdAt}) }}
|
|
{% endif %}
|
|
{% if showMagazineName %}{{ 'to'|trans }} {{ component('magazine_inline', {magazine: comment.magazine}) }}{% endif %}
|
|
{% if showEntryTitle %}{{ 'in'|trans }} {{ component('entry_inline', {entry: comment.entry}) }}{% endif %}
|
|
{% if comment.lang is not same as kbin_default_lang() %}
|
|
<small hidden class="badge">{{ comment.lang }}</small>
|
|
{% endif %}
|
|
</header>
|
|
{% if comment.user.avatar %}
|
|
{{ component('user_avatar', {
|
|
user: comment.user,
|
|
width: 40,
|
|
height: 40,
|
|
asLink: true
|
|
}) }}
|
|
{% endif %}
|
|
<div class="content">
|
|
{% if comment.visibility in ['visible', 'private'] or (comment.visibility is same as 'trashed' and this.canSeeTrashed) %}
|
|
{{ comment.body|markdown|raw }}
|
|
{% elseif(comment.visibility is same as 'trashed') %}
|
|
<p class="text-muted">{{ 'deleted_by_moderator' }}</p>
|
|
{% elseif(comment.visibility is same as 'soft_deleted') %}
|
|
<p class="text-muted">{{ 'deleted_by_author' }}</p>
|
|
{% endif %}
|
|
</div>
|
|
{% if comment.visibility in ['visible', 'private'] %}
|
|
{{ component('vote', {subject: comment}) }}
|
|
{% endif %}
|
|
<footer>
|
|
{% if comment.image %}
|
|
<figure>
|
|
<a href="{{ uploaded_asset(comment.image.filePath) }}"
|
|
class="thumb">
|
|
<img src="{{ asset(comment.image.filePath) |imagine_filter('post_thumb') }}"
|
|
alt="{{ comment.image.altText }}">
|
|
</a>
|
|
</figure>
|
|
{% endif %}
|
|
{% if comment.visibility in ['visible', 'private'] %}
|
|
<menu>
|
|
<li>
|
|
<a class="stretched-link"
|
|
href="{{ entry_comment_create_url(comment) }}#add-comment"
|
|
data-action="subject#getForm">{{ 'reply'|trans|lower }}</a>
|
|
</li>
|
|
<li>
|
|
{{ component('favourite', {subject: comment, path: 'entry_comment_favourite'}) }}
|
|
</li>
|
|
<li class="dropdown">
|
|
<button class="stretched-link" data-subject-target="more">{{ 'more'|trans|lower }}</button>
|
|
<ul class="dropdown__menu" data-controller="clipboard">
|
|
<li>
|
|
<a href="{{ path('entry_comment_report', {id: comment.id}) }}"
|
|
class="{{ html_classes({'active': is_route_name('entry_comment_report')}) }}"
|
|
data-action="subject#getForm">
|
|
{{ 'report'|trans|lower }}
|
|
</a>
|
|
</li>
|
|
<li>
|
|
<a href="{{ entry_comment_voters_url(comment, 'up') }}"
|
|
class="{{ html_classes({'active': is_route_name('entry_comment_favourites') or is_route_name('entry_comment_voters')}) }}">
|
|
{{ 'activity'|trans|lower }}
|
|
</a>
|
|
</li>
|
|
<li>
|
|
<a data-action="clipboard#copy" href="{{ entry_url(comment.entry) }}#{{ get_url_fragment(comment) }}">
|
|
{{ 'copy_url'|trans|lower }}
|
|
</a>
|
|
</li>
|
|
<li>
|
|
<a data-action="clipboard#copy" href="{{ comment.apId ?? path('ap_entry_comment', {magazine_name: comment.magazine.name, entry_id: comment.entry.id, comment_id: comment.id}) }}">
|
|
{{ 'copy_url_to_fediverse'|trans|lower }}
|
|
</a>
|
|
</li>
|
|
{% if is_granted('edit', comment) %}
|
|
<li>
|
|
<a href="{{ entry_comment_edit_url(comment) }}"
|
|
class="{{ html_classes({'active': is_route_name('entry_comment_edit')}) }}"
|
|
data-action="subject#getForm">
|
|
{{ 'edit'|trans|lower }}
|
|
</a>
|
|
</li>
|
|
{% endif %}
|
|
{% if app.user and comment.isAuthor(app.user) %}
|
|
<li>
|
|
<form method="post"
|
|
action="{{ entry_comment_delete_url(comment) }}"
|
|
onsubmit="return confirm('{{ 'are_you_sure'|trans }}');">
|
|
<input type="hidden" name="token"
|
|
value="{{ csrf_token('entry_comment_delete') }}">
|
|
<button type="submit">{{ 'delete'|trans|lower }}</button>
|
|
</form>
|
|
</li>
|
|
{% endif %}
|
|
{% if is_granted('moderate', comment) %}
|
|
<li>
|
|
<a href="{{ entry_comment_moderate_url(comment) }}"
|
|
class="{{ html_classes({'active': is_route_name('entry_comment_moderate')}) }}"
|
|
data-action="subject#showModPanel">
|
|
{{ 'moderate'|trans|lower }}
|
|
</a>
|
|
</li>
|
|
{% endif %}
|
|
</ul>
|
|
</li>
|
|
<li data-subject-target="loader" style="display:none">
|
|
<div class="loader" role="status">
|
|
<span class="visually-hidden">Loading...</span>
|
|
</div>
|
|
</li>
|
|
</menu>
|
|
{% elseif(comment.visibility is same as 'trashed' and this.canSeeTrashed) %}
|
|
<menu>
|
|
<li>
|
|
<form method="post"
|
|
action="{{ path('entry_comment_restore', {magazine_name: comment.magazine.name, entry_id: comment.entry.id, comment_id: comment.id}) }}"
|
|
onsubmit="return confirm('{{ 'are_you_sure'|trans }}');">
|
|
<input type="hidden" name="token" value="{{ csrf_token('entry_comment_restore') }}">
|
|
<button type="submit">{{ 'restore'|trans|lower }}</button>
|
|
</form>
|
|
</li>
|
|
<li data-subject-target="loader" style="display:none">
|
|
<div class="loader" role="status">
|
|
<span class="visually-hidden">Loading...</span>
|
|
</div>
|
|
</li>
|
|
</menu>
|
|
{% else %}
|
|
<menu>
|
|
<li data-subject-target="loader" style="display:none">
|
|
<div class="loader" role="status">
|
|
<span class="visually-hidden">Loading...</span>
|
|
</div>
|
|
</li>
|
|
</menu>
|
|
{% endif %}
|
|
<div data-subject-target="container" class="js-container">
|
|
</div>
|
|
</footer>
|
|
</blockquote>
|
|
{% endif %}
|
|
{% if showNested %}
|
|
{{ component('entry_comments_nested', {
|
|
comment: comment,
|
|
level: level,
|
|
showNested: true
|
|
}) }}
|
|
{% endif %}
|
|
{% endif %} |