Tell scheduling apart from unpublishing in the history
Giving a record a future date was recorded as "unpublished", and announced to webhooks as such. The history now compares before and after. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -131,11 +131,23 @@ trait HasRevisions
|
||||
|
||||
// Ask the model itself: "published" means different things to a page
|
||||
// with a status and a project with only a date.
|
||||
if (method_exists($this, 'isPublishedNow')) {
|
||||
return $this->isPublishedNow() ? 'published' : 'unpublished';
|
||||
if (! method_exists($this, 'isPublishedNow')) {
|
||||
return 'updated';
|
||||
}
|
||||
|
||||
return 'updated';
|
||||
// Before and after, because the change is what has a name: going live,
|
||||
// coming off, or being given a date — which is neither, and which a
|
||||
// history that only asked "is it live now?" called "unpublished".
|
||||
$before = (clone $this)->setRawAttributes($this->getRawOriginal());
|
||||
$now = $this->isPublishedNow();
|
||||
$was = $before->isPublishedNow();
|
||||
|
||||
return match (true) {
|
||||
$now && ! $was => 'published',
|
||||
! $now && $was => 'unpublished',
|
||||
! $now && method_exists($this, 'isScheduled') && $this->isScheduled() => 'scheduled',
|
||||
default => 'updated',
|
||||
};
|
||||
}
|
||||
|
||||
protected function revisionValue(mixed $value): mixed
|
||||
|
||||
Reference in New Issue
Block a user