From 573f861ad154d224085b07d6074fe3c7e985e4bb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javi=20Mart=C3=ADn?= Date: Sun, 10 May 2020 02:34:20 +0200 Subject: [PATCH] Don't use comment_flags to cache comments Flagging a comment automatically updates the comment, so the cache expires anyway, making the `comment_flags` variable redundant. --- app/views/budgets/investments/show.html.erb | 1 - app/views/comments/_comment.html.erb | 3 +-- app/views/comments/_comment_tree.html.erb | 3 +-- app/views/debates/_comments.html.erb | 2 +- app/views/legislation/annotations/show.html.erb | 1 - app/views/legislation/proposals/_comments.html.erb | 2 +- app/views/legislation/questions/show.html.erb | 1 - app/views/polls/_comments.html.erb | 2 +- app/views/proposals/_comments.html.erb | 2 +- app/views/topics/_comments.html.erb | 2 +- .../valuation/budget_investments/_valuation_comments.html.erb | 1 - 11 files changed, 7 insertions(+), 13 deletions(-) diff --git a/app/views/budgets/investments/show.html.erb b/app/views/budgets/investments/show.html.erb index de38661a5..b0eee0ec3 100644 --- a/app/views/budgets/investments/show.html.erb +++ b/app/views/budgets/investments/show.html.erb @@ -19,7 +19,6 @@
<%= render "/comments/comment_tree", comment_tree: @comment_tree, - comment_flags: @comment_flags, display_comments_count: false %>
diff --git a/app/views/comments/_comment.html.erb b/app/views/comments/_comment.html.erb index 0f51daac0..2448dc211 100644 --- a/app/views/comments/_comment.html.erb +++ b/app/views/comments/_comment.html.erb @@ -1,10 +1,9 @@ -<% comment_flags ||= @comment_flags %> <% valuation = local_assigns.fetch(:valuation, false) %> <% allow_votes = local_assigns.fetch(:allow_votes, true) %> <% allow_actions = local_assigns.fetch(:allow_actions, true) %> <% allow_comments = local_assigns.fetch(:allow_comments, true) %> <% admin_layout = local_assigns.fetch(:admin_layout, false) %> -<% cache [locale_and_user_status(comment), comment, commentable_cache_key(comment.commentable), comment.author, (comment_flags[comment.id] if comment_flags), (admin_layout if admin_layout)] do %> +<% cache [locale_and_user_status(comment), comment, commentable_cache_key(comment.commentable), comment.author, (admin_layout if admin_layout)] do %>