From 061ee919a7ee880ed39963f4fc8bd2b2f2c646bb Mon Sep 17 00:00:00 2001 From: swag Date: Sun, 14 May 2023 16:17:10 -0400 Subject: [PATCH] Handle 404 stuff better for thread.by_id --- lib/PostText/Controller/Thread.pm | 5 +++-- t/thread.t | 3 +++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/PostText/Controller/Thread.pm b/lib/PostText/Controller/Thread.pm index e0d1fbe..43d0b02 100644 --- a/lib/PostText/Controller/Thread.pm +++ b/lib/PostText/Controller/Thread.pm @@ -62,8 +62,9 @@ sub by_id($self) { } else { $self->stash( - thread => [], - status => 404 + thread => {}, + remarks => [], + status => 404 ) } diff --git a/t/thread.t b/t/thread.t index ab538d9..6577a72 100644 --- a/t/thread.t +++ b/t/thread.t @@ -36,6 +36,9 @@ subtest 'View single thread', sub { $t->get_ok('/thread/single/1/1')->status_is(200) ->text_like(h2 => qr/Thread #1/); + + $t->get_ok('/thread/single/65536')->status_is(404) + ->text_like(h2 => qr/Thread #/); }; subtest 'Threads feed', sub {