From b900c8de92bdab08ddd825a2fd954e6d31197a7e Mon Sep 17 00:00:00 2001 From: Ben Halpern Date: Wed, 13 Oct 2021 10:23:25 -0400 Subject: [PATCH] Remove legacy "deleted commentable" view (#15052) * Remove unneeded extra page * Update app/views/comments/index.html.erb Co-authored-by: Michael Kohl * Update app/views/comments/index.html.erb Co-authored-by: Michael Kohl --- app/controllers/comments_controller.rb | 2 - app/views/comments/_comment.html.erb | 2 +- app/views/comments/_comment_header.html.erb | 2 +- app/views/comments/_comment_proper.html.erb | 2 +- .../deleted_commentable_comment.html.erb | 63 ------------ app/views/comments/index.html.erb | 96 ++++++++++--------- spec/requests/comments_spec.rb | 4 +- 7 files changed, 56 insertions(+), 115 deletions(-) delete mode 100644 app/views/comments/deleted_commentable_comment.html.erb diff --git a/app/controllers/comments_controller.rb b/app/controllers/comments_controller.rb index 11e803a6f..0eed27323 100644 --- a/app/controllers/comments_controller.rb +++ b/app/controllers/comments_controller.rb @@ -36,8 +36,6 @@ class CommentsController < ApplicationController @commentable_type = @commentable.class.name if @commentable set_surrogate_key_header "comments-for-#{@commentable.id}-#{@commentable_type}" if @commentable - - render :deleted_commentable_comment unless @commentable end # rubocop:enable Metrics/CyclomaticComplexity # rubocop:enable Metrics/PerceivedComplexity diff --git a/app/views/comments/_comment.html.erb b/app/views/comments/_comment.html.erb index e00c8a26d..ca2f59cf0 100644 --- a/app/views/comments/_comment.html.erb +++ b/app/views/comments/_comment.html.erb @@ -19,7 +19,7 @@ <%= "comment--too-deep" if comment.depth > 3 %> " data-comment-id="<%= comment.id %>" - data-path="<%= commentable.path %>/comments/<%= comment.id_code_generated %>" + data-path="<%= commentable&.path %>/comments/<%= comment.id_code_generated %>" data-comment-author-id="<%= comment_user_id_unless_deleted comment %>" data-content-user-id="<%= comment_user_id_unless_deleted comment %>"> <%= render("comments/comment_proper", diff --git a/app/views/comments/_comment_header.html.erb b/app/views/comments/_comment_header.html.erb index bffdfc5d5..0f19bbc2d 100644 --- a/app/views/comments/_comment_header.html.erb +++ b/app/views/comments/_comment_header.html.erb @@ -30,7 +30,7 @@
  • <%= t("core.copy_link") %>
  • <% action = comment.hidden_by_commentable_user ? "Unhide" : "Hide" %> -