From 13cf1d9449e4b4cd278d62cbf36c78f1b188f788 Mon Sep 17 00:00:00 2001 From: rgarcia Date: Mon, 7 Sep 2015 10:55:23 +0200 Subject: [PATCH] removes all comments cache --- app/views/comments/_comment.html.erb | 194 +++++++++++++-------------- app/views/debates/_comments.html.erb | 48 ++++--- 2 files changed, 119 insertions(+), 123 deletions(-) diff --git a/app/views/comments/_comment.html.erb b/app/views/comments/_comment.html.erb index 739c3d4c8..d29c19ebe 100644 --- a/app/views/comments/_comment.html.erb +++ b/app/views/comments/_comment.html.erb @@ -1,104 +1,102 @@ -<% cache [locale_and_user_status(comment), comment, @commentable, comment.author, (@comment_flags[comment.id] if @comment_flags)] do %> -
-
+
+
- <% if comment.hidden? || comment.user.hidden? %> - <% if select_children(@comments, comment).size > 0 %> -
-

<%= t("debates.comment.deleted") %>

-
- <% end %> - <% else %> - <% if comment.as_administrator? %> - <%= image_tag("admin_avatar.png", size: 32, class: "admin-avatar left") %> - <% elsif comment.as_moderator? %> - <%= image_tag("moderator_avatar.png", size: 32, class: "moderator-avatar left") %> - <% else %> - <% if comment.user.organization? %> - <%= image_tag("collective_avatar.png", size: 32, class: "avatar left") %> - <% else %> - <%= avatar_image(comment.user, seed: comment.user_id, size: 32, class: "left") %> - <% end %> - <% if comment.user.hidden? %> - - <% end %> - <% end %> - -
-
- - <% if comment.as_administrator? %> - <%= t("debates.comment.admin") %> #<%= comment.administrator_id%> - <% elsif comment.as_moderator? %> - <%= t("debates.comment.moderator") %> #<%= comment.moderator_id%> - <% else %> - - <% if comment.user.hidden? %> - <%= t("debates.comment.user_deleted") %> - <% else %> - <%= comment.user.name %> - <% if comment.user.official? %> -  •  - - <%= comment.user.official_position %> - - <% end %> - <% end %> - <% if comment.user.verified_organization? %> -  •  - - <%= t("shared.collective") %> - - <% end %> - <% if comment.user_id == @commentable.author_id %> -  •  - - <%= t("debates.comment.author") %> - - <% end %> - - <% end %> - -  • <%= time_ago_in_words(comment.created_at) %> -
- - <% if comment.as_administrator? %> -

<%= comment.body %>

- <% elsif comment.as_moderator? %> -

<%= comment.body %>

- <% elsif comment.user.official? && comment.user_id == @commentable.author_id %> -

<%= comment.body %>

- <% elsif comment.user.official? %> -

<%= comment.body %>

- <% elsif comment.user_id == @commentable.author_id %> -

<%= comment.body %>

- <% else %> -

<%= comment.body %>

- <% end %> - - <%= render 'comments/votes', comment: comment %> - - -
- <%= t("debates.comment.responses", count: select_children(@comments, comment).size) %> - - <% if user_signed_in? %> -  |  - <%= link_to(comment_link_text(comment), "", - class: "js-add-comment-link", data: {'id': dom_id(comment)}) %> - - <%= render 'comments/actions', comment: comment %> - - <%= render 'comments/form', {commentable: @commentable, parent_id: comment.id, toggeable: true} %> - <% end %> -
+ <% if comment.hidden? || comment.user.hidden? %> + <% if select_children(@comments, comment).size > 0 %> +
+

<%= t("debates.comment.deleted") %>

<% end %> -<% end %> -
- <% select_children(@comments, comment).each do |child| %> - <%= render 'comments/comment', comment: child %> + <% else %> + <% if comment.as_administrator? %> + <%= image_tag("admin_avatar.png", size: 32, class: "admin-avatar left") %> + <% elsif comment.as_moderator? %> + <%= image_tag("moderator_avatar.png", size: 32, class: "moderator-avatar left") %> + <% else %> + <% if comment.user.organization? %> + <%= image_tag("collective_avatar.png", size: 32, class: "avatar left") %> + <% else %> + <%= avatar_image(comment.user, seed: comment.user_id, size: 32, class: "left") %> + <% end %> + <% if comment.user.hidden? %> + + <% end %> <% end %> -
+ +
+
+ + <% if comment.as_administrator? %> + <%= t("debates.comment.admin") %> #<%= comment.administrator_id%> + <% elsif comment.as_moderator? %> + <%= t("debates.comment.moderator") %> #<%= comment.moderator_id%> + <% else %> + + <% if comment.user.hidden? %> + <%= t("debates.comment.user_deleted") %> + <% else %> + <%= comment.user.name %> + <% if comment.user.official? %> +  •  + + <%= comment.user.official_position %> + + <% end %> + <% end %> + <% if comment.user.verified_organization? %> +  •  + + <%= t("shared.collective") %> + + <% end %> + <% if comment.user_id == @commentable.author_id %> +  •  + + <%= t("debates.comment.author") %> + + <% end %> + + <% end %> + +  • <%= time_ago_in_words(comment.created_at) %> +
+ + <% if comment.as_administrator? %> +

<%= comment.body %>

+ <% elsif comment.as_moderator? %> +

<%= comment.body %>

+ <% elsif comment.user.official? && comment.user_id == @commentable.author_id %> +

<%= comment.body %>

+ <% elsif comment.user.official? %> +

<%= comment.body %>

+ <% elsif comment.user_id == @commentable.author_id %> +

<%= comment.body %>

+ <% else %> +

<%= comment.body %>

+ <% end %> + + <%= render 'comments/votes', comment: comment %> + + +
+ <%= t("debates.comment.responses", count: select_children(@comments, comment).size) %> + + <% if user_signed_in? %> +  |  + <%= link_to(comment_link_text(comment), "", + class: "js-add-comment-link", data: {'id': dom_id(comment)}) %> + + <%= render 'comments/actions', comment: comment %> + + <%= render 'comments/form', {commentable: @commentable, parent_id: comment.id, toggeable: true} %> + <% end %> +
+
+ <% end %> +
+ <% select_children(@comments, comment).each do |child| %> + <%= render 'comments/comment', comment: child %> + <% end %>
+
\ No newline at end of file diff --git a/app/views/debates/_comments.html.erb b/app/views/debates/_comments.html.erb index fe7fc3cb3..5fbea960d 100644 --- a/app/views/debates/_comments.html.erb +++ b/app/views/debates/_comments.html.erb @@ -1,30 +1,28 @@ -<% cache [locale_and_user_status, @all_visible_comments, @all_visible_comments.map(&:author), @debate.comments_count, @comment_flags] do %> -
-
-
+
+
+
-

- <%= t("debates.show.comments_title") %> - (<%= @debate.comments_count %>) -

+

+ <%= t("debates.show.comments_title") %> + (<%= @debate.comments_count %>) +

- <% if user_signed_in? %> - <%= render 'comments/form', {commentable: @debate, parent_id: nil, toggeable: false} %> - <% else %> -
+ <% if user_signed_in? %> + <%= render 'comments/form', {commentable: @debate, parent_id: nil, toggeable: false} %> + <% else %> +
-
- <%= t("debates.show.login_to_comment", - signin: link_to(t("votes.signin"), new_user_session_path), - signup: link_to(t("votes.signup"), new_user_registration_path)).html_safe %> -
- <% end %> +
+ <%= t("debates.show.login_to_comment", + signin: link_to(t("votes.signin"), new_user_session_path), + signup: link_to(t("votes.signup"), new_user_registration_path)).html_safe %> +
+ <% end %> - <% @root_comments.each do |comment| %> - <%= render 'comments/comment', comment: comment %> - <% end %> - <%= paginate @root_comments %> -
+ <% @root_comments.each do |comment| %> + <%= render 'comments/comment', comment: comment %> + <% end %> + <%= paginate @root_comments %>
-
-<% end %> \ No newline at end of file +
+
\ No newline at end of file