docbrown/app/views/articles/_full_comment_area.html.erb
Alex b02d43ca2d
Create DiscussionLocks (#13905)
* Create DiscussionLocks

* Fix specs

* Update nullify_blank_notes_and_reason

* Update before_validation call

* Updated DiscussionLockPolicy for clarity

* Move permitted_attributes to a constant

* Update route

* Apply suggestions from code review for frontend

Co-authored-by: Suzanne Aitchison <suzanne@forem.com>

* Add title tags

* Wrap unlock confirm in main element

* Wrap flash messages up in div

* Actually fix title tags

* Hide comment reply button when discussion is locked

* Add E2E tests

* Try to fix E2E tests

* Cypress...you work locally but not in CI...why!?

* PR feedback

* Update E2E tests

* More E2E updates 😭

Co-authored-by: Suzanne Aitchison <suzanne@forem.com>
2021-06-10 11:04:33 -04:00

41 lines
1.8 KiB
Text

<% cache("whole-comment-area-#{@article.id}-#{@article.last_comment_at}-#{@article.show_comments}-#{@discussion_lock&.updated_at}", expires_in: 2.hours) do %>
<section id="comments" data-updated-at="<%= Time.current %>" class="text-padding mb-4 border-t-1 border-0 border-solid border-base-10">
<% if @article.show_comments %>
<header class="relative flex justify-between items-center mb-6">
<h2 class="crayons-subtitle-1">Discussion <span class="js-comments-count" data-comments-count="<%= @article.comments_count %>">(<%= @article.comments_count %>)</span></h2>
<div id="comment-subscription" class="print-hidden">
<div role="presentation" class="crayons-btn-group">
<span class="crayons-btn crayons-btn--outlined">Subscribe</span>
</div>
</div>
</header>
<div
id="comments-container"
data-testid="comments-container"
data-commentable-id="<%= @article.id %>"
data-commentable-type="Article"
data-has-recent-comment-activity="<%= @article.has_recent_comment_activity? %>">
<% if @discussion_lock %>
<%= render "/comments/discussion_lock_reason" %>
<% else %>
<%= render "/comments/form", commentable: @article, commentable_type: "Article" %>
<% end %>
<div class="comments" id="comment-trees-container">
<% if @article.comments_count > 0 %>
<% Comment.tree_for(@article, @comments_to_show_count).each do |comment, sub_comments| %>
<% cache ["comment_root_cached_tree", comment] do %>
<%= tree_for(comment, sub_comments, @article) %>
<% end %>
<% end %>
<% end %>
</div>
</div>
<%= render "articles/comments_actions" %>
<% end %>
</section>
<% end %>
<% return if @warm_only %>