From bb22c3c775efc09f735b24e7c4a2245fcb39cb40 Mon Sep 17 00:00:00 2001 From: swag Date: Fri, 2 Jun 2023 15:11:15 -0400 Subject: [PATCH] Don't show hidden for single_thread and single_remark --- lib/PostText/Model/Remark.pm | 3 ++- lib/PostText/Model/Thread.pm | 1 + templates/thread/by_id.html.ep | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/PostText/Model/Remark.pm b/lib/PostText/Model/Remark.pm index f5b98b2..7b492a4 100644 --- a/lib/PostText/Model/Remark.pm +++ b/lib/PostText/Model/Remark.pm @@ -87,7 +87,8 @@ sub by_id($self, $remark_id) { remark_body AS body, thread_id FROM remarks - WHERE remark_id = ?; + WHERE remark_id = ? + AND NOT hidden_status; END_SQL } diff --git a/lib/PostText/Model/Thread.pm b/lib/PostText/Model/Thread.pm index 231f566..2d22a80 100644 --- a/lib/PostText/Model/Thread.pm +++ b/lib/PostText/Model/Thread.pm @@ -82,6 +82,7 @@ sub by_id($self, $thread_id) { LEFT JOIN remarks AS r ON t.thread_id = r.thread_id WHERE t.thread_id = ? + AND NOT t.hidden_status GROUP BY t.thread_id; END_SQL } diff --git a/templates/thread/by_id.html.ep b/templates/thread/by_id.html.ep index 73e8f42..11277a3 100644 --- a/templates/thread/by_id.html.ep +++ b/templates/thread/by_id.html.ep @@ -38,7 +38,7 @@ <% } =%> -<% if (scalar @{$remarks}) { =%> +<% if (keys %{$thread} && scalar @{$remarks}) { =%>

Remarks

<% for my $remark (@{$remarks}) { =%>