From d2a873a4e9c9b98946c5914f1c32ca3ead81ca52 Mon Sep 17 00:00:00 2001 From: Carl Chenet Date: Tue, 16 May 2017 18:41:52 +0200 Subject: [PATCH] when highlighting a comment, force it and its parents to show --- app/controllers/stories_controller.rb | 3 +++ app/views/comments/_comment.html.erb | 4 +++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/app/controllers/stories_controller.rb b/app/controllers/stories_controller.rb index 0b9a39a..060304a 100644 --- a/app/controllers/stories_controller.rb +++ b/app/controllers/stories_controller.rb @@ -137,10 +137,13 @@ class StoriesController < ApplicationController @comments = @story.merged_comments.includes(:user, :story, :hat).arrange_for_user(@user) + @force_show_thread_id = nil + if params[:comment_short_id] @comments.each do |c,x| if c.short_id == params[:comment_short_id] c.highlighted = true + @force_show_thread_id = c.thread_id break end end diff --git a/app/views/comments/_comment.html.erb b/app/views/comments/_comment.html.erb index ee3aee1..38b9055 100644 --- a/app/views/comments/_comment.html.erb +++ b/app/views/comments/_comment.html.erb @@ -1,6 +1,8 @@ > + <%= comment.score <= Comment::DOWNVOTABLE_MIN_SCORE && + !(@force_show_thread_id && @force_show_thread_id == comment.thread_id) ? + "checked" : "" %>>