From be27dd41f0d2b9d077e29ed7a0a01f46f38b1557 Mon Sep 17 00:00:00 2001 From: Christoph Stockinger Date: Wed, 25 Feb 2026 23:07:43 +0100 Subject: [PATCH 1/2] [6.x] Fix calculation of current state --- src/Entries/Entry.php | 4 ++-- src/Stache/Query/QueriesEntryStatus.php | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Entries/Entry.php b/src/Entries/Entry.php index 52289236bfa..d674f015918 100644 --- a/src/Entries/Entry.php +++ b/src/Entries/Entry.php @@ -791,11 +791,11 @@ public function status() return 'published'; } - if ($collection->futureDateBehavior() === 'private' && $this->date()->isFuture()) { + if (($collection->futureDateBehavior() === 'private' || $collection->futureDateBehavior() === 'unlisted') && $this->date()->isFuture()) { return 'scheduled'; } - if ($collection->pastDateBehavior() === 'private' && $this->date()->isPast()) { + if (($collection->pastDateBehavior() === 'private' || $collection->pastDateBehavior() === 'unlisted') && $this->date()->isPast()) { return 'expired'; } diff --git a/src/Stache/Query/QueriesEntryStatus.php b/src/Stache/Query/QueriesEntryStatus.php index 05885635219..08f6334fa3f 100644 --- a/src/Stache/Query/QueriesEntryStatus.php +++ b/src/Stache/Query/QueriesEntryStatus.php @@ -45,7 +45,7 @@ private function addCollectionStatusLogicToQuery($query, $status, $collection): return; } - if ($collection->futureDateBehavior() === 'private') { + if ($collection->futureDateBehavior() === 'private' || $collection->futureDateBehavior() === 'unlisted') { $status === 'scheduled' ? $query->where('date', '>', now()) : $query->where('date', '<', now()); @@ -55,7 +55,7 @@ private function addCollectionStatusLogicToQuery($query, $status, $collection): } } - if ($collection->pastDateBehavior() === 'private') { + if ($collection->pastDateBehavior() === 'private' || $collection->pastDateBehavior() === 'unlisted') { $status === 'expired' ? $query->where('date', '<', now()) : $query->where('date', '>', now()); From da9d2cf1325305848d2cf318fdb8e46b7aa857ff Mon Sep 17 00:00:00 2001 From: Christoph Stockinger Date: Thu, 26 Feb 2026 00:06:23 +0100 Subject: [PATCH 2/2] Fixes tests --- tests/Tags/Collection/EntriesTest.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/Tags/Collection/EntriesTest.php b/tests/Tags/Collection/EntriesTest.php index d99325bc783..d7e80bef030 100644 --- a/tests/Tags/Collection/EntriesTest.php +++ b/tests/Tags/Collection/EntriesTest.php @@ -281,10 +281,10 @@ public function it_filters_by_future_and_past() // Only future $this->collection->dated(true)->futureDateBehavior('public')->pastDateBehavior('unlisted')->save(); - $this->assertCount(3, $this->getEntries()); + $this->assertCount(0, $this->getEntries(['show_future' => false])); $this->assertCount(3, $this->getEntries(['show_future' => true])); - $this->assertCount(8, $this->getEntries(['show_past' => true])); + $this->assertCount(3, $this->getEntries(['show_past' => true])); $this->assertCount(3, $this->getEntries(['show_past' => false])); $this->assertCount(3, $this->getEntries(['show_past' => false, 'show_future' => true])); @@ -300,10 +300,10 @@ public function it_filters_by_future_and_past() $this->collection->dated(true)->futureDateBehavior('unlisted')->pastDateBehavior('public')->save(); $this->assertCount(4, $this->getEntries()); $this->assertCount(4, $this->getEntries(['show_future' => false])); - $this->assertCount(8, $this->getEntries(['show_future' => true])); + $this->assertCount(4, $this->getEntries(['show_future' => true])); $this->assertCount(4, $this->getEntries(['show_past' => true])); $this->assertCount(0, $this->getEntries(['show_past' => false])); - $this->assertCount(3, $this->getEntries(['show_past' => false, 'show_future' => true])); + $this->assertCount(0, $this->getEntries(['show_past' => false, 'show_future' => true])); $this->collection->dated(true)->futureDateBehavior('private')->pastDateBehavior('public')->save(); $this->assertCount(4, $this->getEntries());