diff --git a/app/components/shared/comments_component.html.erb b/app/components/shared/comments_component.html.erb
index fd6b3d8ed..e4eee07b7 100644
--- a/app/components/shared/comments_component.html.erb
+++ b/app/components/shared/comments_component.html.erb
@@ -4,13 +4,13 @@
<% cache cache_key do %>
<% if current_user %>
- <%= render "comments/form", { commentable: record, parent_id: nil } %>
+ <%= render "comments/form", { commentable: record, parent_id: nil, valuation: valuation } %>
<% else %>
<%= render "shared/login_to_comment" %>
<% end %>
<%= render Shared::OrderLinksComponent.new("comments", anchor: "comments") %>
- <%= render "comments/comment_list", comments: comment_tree.root_comments %>
+ <%= render "comments/comment_list", comments: comment_tree.root_comments, valuation: valuation %>
<%= paginate comment_tree.root_comments, params: { anchor: "comments" } %>
<% end %>
diff --git a/app/components/shared/comments_component.rb b/app/components/shared/comments_component.rb
index f9c9a07ef..d94c8bd1c 100644
--- a/app/components/shared/comments_component.rb
+++ b/app/components/shared/comments_component.rb
@@ -1,10 +1,11 @@
class Shared::CommentsComponent < ApplicationComponent
- attr_reader :record, :comment_tree
+ attr_reader :record, :comment_tree, :valuation
use_helpers :current_user, :current_order, :locale_and_user_status, :commentable_cache_key
- def initialize(record, comment_tree)
+ def initialize(record, comment_tree, valuation: false)
@record = record
@comment_tree = comment_tree
+ @valuation = valuation
end
private
diff --git a/app/views/comments/_comment_tree.html.erb b/app/views/comments/_comment_tree.html.erb
deleted file mode 100644
index 8bf774553..000000000
--- a/app/views/comments/_comment_tree.html.erb
+++ /dev/null
@@ -1,23 +0,0 @@
-<% commentable = comment_tree.commentable %>
-<% valuation = local_assigns.fetch(:valuation, false) %>
-<% cache [locale_and_user_status, comment_tree.order, commentable_cache_key(commentable), comment_tree.comments, comment_tree.comment_authors, commentable.comments_count] do %>
-
-<% end %>
diff --git a/app/views/comments/_form.html.erb b/app/views/comments/_form.html.erb
index 2a49d2817..01b210c79 100644
--- a/app/views/comments/_form.html.erb
+++ b/app/views/comments/_form.html.erb
@@ -1,4 +1,3 @@
-<% valuation = local_assigns.fetch(:valuation, false) %>
<% cache [locale_and_user_status, parent_id, commentable_cache_key(commentable), valuation] do %>
<% if comments_closed_for_commentable?(commentable) %>
@@ -10,7 +9,7 @@