Review, publish, preview and undo changes through the API

Revisions now call publishing only what publishes: a project's status is
whether the work is active, and a service is published by its flag.

The fake identity server answers by token, so a test can sign in a second
person.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-01 08:29:48 +02:00
parent 4c4a2b3299
commit 5b46436641
18 changed files with 1899 additions and 13 deletions

View File

@@ -5,6 +5,7 @@ declare(strict_types=1);
namespace App\Models\Concerns;
use App\Models\Revision;
use App\Support\AdminContent;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\MorphMany;
use Illuminate\Support\Facades\Auth;
@@ -119,7 +120,12 @@ trait HasRevisions
*/
protected function revisionEvent(array $changes): string
{
if (! array_key_exists('published_at', $changes) && ! array_key_exists('status', $changes)) {
// Which fields put this kind of record on the site: a project's
// `status` is whether the work is active, not whether it is public,
// and a service is published by a flag.
$publication = AdminContent::publicationFields($this) ?: ['published_at', 'status'];
if (array_intersect(array_keys($changes), $publication) === []) {
return 'updated';
}