docbrown/app/views/comments/_comment_proper.html.erb
Anna Buianova 7125a62db0
Changed logic for hiding and displaying low-quality marker for comments based on their score (#20581)
* Specs for revised comments thresholds

* Changed thresholds for low quality comments

* Added specs for comments page

* Fixed /comments and related specs

* Reorganized code for comments trees

* Specs for podcasts episodes comments

* Refactored Comments::Tree

* Refactored Comments::Tree + added specs

* Made build_sort_query private
2024-02-05 09:27:24 -05:00

55 lines
1.9 KiB
Text

<% decorated_comment = comment.decorate %>
<div class="comment__inner">
<%= render partial: "comments/comment_avatar", locals: { comment: comment } %>
<div class="inner-comment comment__details">
<div class="comment__content crayons-card">
<% if comment.deleted || decorated_comment.super_low_quality %>
<div class="p-6 align-center opacity-50 fs-s">
<span class="js-comment-username">
<%= t("views.comments.delete.comment_deleted") %>
</span>
</div>
<% else %>
<%= render partial: "comments/comment_quality_marker", locals: {
comment: comment,
decorated_comment: decorated_comment
} %>
<%= render partial: "comments/comment_header", locals: {
comment: comment,
commentable: commentable,
decorated_comment: decorated_comment
} %>
<div
class="
comment__body
text-styles
text-styles--secondary
body
<%= "color-base-60" if comment.decorate.low_quality %>
<%= should_be_hidden?(comment, @root_comment) ? "element-hidden-by-commentable-user" : "" %>
">
<%= comment.safe_processed_html %>
</div>
<% if should_be_hidden?(comment, @root_comment) %>
<div class="p-6 align-center opacity-50 fs-s hidden comment-hidden-by-author-text">
<%= t("views.comments.hidden.comment_hidden") %>
</div>
<% end %>
<% end %>
</div>
<%= unless comment.deleted || commentable.nil? || should_be_hidden?(comment, @root_comment)
(render partial: "comments/comment_footer", locals: {
comment: comment,
commentable: commentable,
is_childless: is_childless
})
end %>
</div>
</div>
<%= subtree_html %>