<%= javascript_include_tag "postCommentsPage", defer: true %> <% if @root_comment.present? %> <% title(@root_comment.title.to_s) %> <% else %> <% title(t("views.comments.meta.title_root", title: @commentable.title)) %> <% end %> <% if @commentable %> <%= content_for :page_meta do %> "> <%= meta_keywords_article %> " /> " /> "> "> <% if @root_comment.present? %> " /> "> <% if @root_comment.score < 0 || @commentable.score < 0 %> <% end %> <% else %> " /> " /> " /> "> <% if @commentable.class.name == "Article" && @commentable.published %> <% end %> <% end %> <% end %> <% end %> <%= javascript_include_tag "commentDropdowns", "followButtons", defer: true %>
<% if @commentable && @commentable.class.name == "Article" %> <%= render "shared/payment_pointer", user: @commentable.user %> <% end %> <% unless @root_comment %>
<% if @commentable.respond_to?(:main_image) && @commentable.main_image.present? %>
Cover image for <%= @commentable.title %>
<% end %>

<%= @commentable.title %>

<%= t("views.comments.parent.metadata_html", name: @commentable.is_a?(PodcastEpisode) ? @commentable.podcast.name : @commentable.user.name, on: tag.span(@commentable.published_at ? t("views.comments.parent.date", date: @commentable.published_at.strftime(t("time.formats.comment"))) : "", class: %w[published-at])) %>

<% if @commentable.processed_html.present? %>
<% if @commentable.processed_html.size < 350 %> <%= sanitize_rendered_markdown(@commentable.processed_html) %> <% else %> <%= truncate(sanitize(@commentable.processed_html, tags: []), length: 150) %>
<% end %>
<% else %> <%= javascript_include_tag "commentsDisplay", defer: true %>
<% if @commentable %>

<%= t("views.comments.parent.subtitle_html", start: tag("span", { class: %w[fw-normal color-base-60] }, true), end: "".html_safe, title: tag.span(@commentable.title)) %>

<% else %> <%= t("views.comments.orphan.deleted") %> <% end %>
<% end %> <% if @root_comment.present? && (@root_comment.depth > 0 && parent = @root_comment.parent) %>

<%= t("views.comments.parent.reply_html", start: tag("span", { class: %w[fw-normal opacity-75] }, true), end: "".html_safe, title: tag.span(parent.title(150))) %>

<% end %>
"> <% unless @root_comment %> <% if @discussion_lock %> <%= render "discussion_lock_reason" %> <% else %> <%= render "form", commentable: @commentable, commentable_type: "Article" %> <% end %> <% end %>
<% if @root_comment.present? %> <% cache ["comment_root-view-root_#{user_signed_in?}", @root_comment] do %> <%= tree_for(@root_comment, @root_comment.subtree.includes(user: %i[setting profile]).arrange[@root_comment], @commentable) %> <% end %> <% else %> <% Comment.tree_for(@commentable).each do |comment, sub_comments| %> <% cache ["comment_root_#{user_signed_in?}", comment] do %> <%= tree_for(comment, sub_comments, @commentable) %> <% end %> <% end %> <% end %>
<% if @commentable&.any_comments_hidden %>

<%= t("views.comments.hidden.text_html", info: link_to(t("views.comments.hidden.info"), "/faq#what-does-comment-hidden-by-post-author-mean")) %>

<% end %>
<%= render "articles/conduct_and_abuse_actions", page: "comments_index" %>
<% if @commentable && has_vid?(@commentable) %> <%= render "articles/fitvids" %> <% end %>
<%== TwitterTimelineTag.script %> <%= render "comments/hide_comments_modal" %>