Skip to content

Commit be27dd4

Browse files
[6.x] Fix calculation of current state
1 parent c499caf commit be27dd4

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/Entries/Entry.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -791,11 +791,11 @@ public function status()
791791
return 'published';
792792
}
793793

794-
if ($collection->futureDateBehavior() === 'private' && $this->date()->isFuture()) {
794+
if (($collection->futureDateBehavior() === 'private' || $collection->futureDateBehavior() === 'unlisted') && $this->date()->isFuture()) {
795795
return 'scheduled';
796796
}
797797

798-
if ($collection->pastDateBehavior() === 'private' && $this->date()->isPast()) {
798+
if (($collection->pastDateBehavior() === 'private' || $collection->pastDateBehavior() === 'unlisted') && $this->date()->isPast()) {
799799
return 'expired';
800800
}
801801

src/Stache/Query/QueriesEntryStatus.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ private function addCollectionStatusLogicToQuery($query, $status, $collection):
4545
return;
4646
}
4747

48-
if ($collection->futureDateBehavior() === 'private') {
48+
if ($collection->futureDateBehavior() === 'private' || $collection->futureDateBehavior() === 'unlisted') {
4949
$status === 'scheduled'
5050
? $query->where('date', '>', now())
5151
: $query->where('date', '<', now());
@@ -55,7 +55,7 @@ private function addCollectionStatusLogicToQuery($query, $status, $collection):
5555
}
5656
}
5757

58-
if ($collection->pastDateBehavior() === 'private') {
58+
if ($collection->pastDateBehavior() === 'private' || $collection->pastDateBehavior() === 'unlisted') {
5959
$status === 'expired'
6060
? $query->where('date', '<', now())
6161
: $query->where('date', '>', now());

0 commit comments

Comments
 (0)