Let users see when a post has deleted comments. Show normal users a '[deleted]' placeholder when a comment is deleted. Show the full comment to moderators. Also fix it so that the comment creator can't edit or undelete deleted comments, and users can't vote on or report deleted comments. Finally, hide the creator_id, updater_id, and body of deleted comments in the API.
20 lines
748 B
Plaintext
20 lines
748 B
Plaintext
<div id="p-index-by-comment" class="comments-for-post">
|
|
<div class="list-of-comments list-of-messages">
|
|
<% dtext_data = DText.preprocess(@comments.map(&:body)) %>
|
|
|
|
<% @comments.each do |comment| %>
|
|
<%= tag.div id: "post_#{comment.post.id}", **PostPreviewComponent.new(post: comment.post).article_attrs("post") do %>
|
|
<div class="preview">
|
|
<% if policy(comment.post).visible? %>
|
|
<%= link_to(image_tag(comment.post.preview_file_url), post_path(comment.post)) %>
|
|
<% end %>
|
|
</div>
|
|
|
|
<%= render_comment(comment, dtext_data: dtext_data, context: :index_by_comment, current_user: CurrentUser.user) %>
|
|
<% end %>
|
|
<% end %>
|
|
</div>
|
|
</div>
|
|
|
|
<%= numbered_paginator(@comments) %>
|