newsroom: Seite verschwindet mit der letzten veröffentlichten Meldung (Roadmap 1b.1/1b.5)
Die Sichtbarkeitsregel bestand bereits (Detailseite 404, Verzeichnis und Sitemap nur mit veröffentlichter Meldung). Neu: archive(), changeStatusFromAdmin() weg von published und deleteFromAdmin() einer veröffentlichten Meldung leeren den Seiten-Cache — vorher blieb die Newsroom-Seite bis zu eine Stunde stehen, während die Depublikation längst sofort griff. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
0f52e9fddc
commit
a3e0042055
2 changed files with 55 additions and 0 deletions
|
|
@ -383,6 +383,11 @@ class PressReleaseService
|
|||
$previous = $pressRelease->status;
|
||||
|
||||
$pressRelease->update(['status' => PressReleaseStatus::Archived->value]);
|
||||
// Sichtbarkeitsregel (Roadmap 1b.1/1b.5): Ein Newsroom ist öffentlich
|
||||
// nur mit mindestens einer veröffentlichten Meldung. Fällt die letzte
|
||||
// weg, muss auch seine Seite sofort weg — nicht erst nach Ablauf des
|
||||
// Seiten-Caches.
|
||||
WebCaches::forgetPublicPages();
|
||||
$this->logStatusChange($pressRelease, $previous, PressReleaseStatus::Archived, null, 'admin');
|
||||
}
|
||||
|
||||
|
|
@ -439,6 +444,10 @@ class PressReleaseService
|
|||
if ($previous !== $status) {
|
||||
$this->logStatusChange($locked, $previous, $status, $reason, 'admin');
|
||||
}
|
||||
|
||||
if ($previous === PressReleaseStatus::Published && $status !== PressReleaseStatus::Published) {
|
||||
WebCaches::forgetPublicPages();
|
||||
}
|
||||
});
|
||||
|
||||
$pressRelease->refresh();
|
||||
|
|
@ -457,6 +466,7 @@ class PressReleaseService
|
|||
'backlink_url' => null,
|
||||
'no_export' => true,
|
||||
]);
|
||||
WebCaches::forgetPublicPages();
|
||||
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,9 +1,11 @@
|
|||
<?php
|
||||
|
||||
use App\Enums\Portal;
|
||||
use App\Enums\PressReleaseStatus;
|
||||
use App\Models\Category;
|
||||
use App\Models\Company;
|
||||
use App\Models\PressRelease;
|
||||
use App\Services\PressRelease\PressReleaseService;
|
||||
use Illuminate\Support\Str;
|
||||
use Tests\TestCase;
|
||||
|
||||
|
|
@ -118,6 +120,49 @@ test('the newsroom detail page returns 404 when the company has no published rel
|
|||
->assertNotFound();
|
||||
});
|
||||
|
||||
test('the newsroom page disappears with its last published release, cache included', function () {
|
||||
/** @var TestCase $this */
|
||||
// Roadmap 1b.1/1b.5: öffentlich nur mit veröffentlichter Meldung — und
|
||||
// der Rückbau greift sofort, nicht erst nach Ablauf des Seiten-Caches.
|
||||
$company = makeNewsroom('Einmalig AG');
|
||||
$release = publishForCompany($company, 'Die einzige Meldung');
|
||||
$url = 'https://businessportal24.test/de/newsroom/'.$company->slug;
|
||||
|
||||
$this->get($url)->assertOk();
|
||||
$this->get('https://businessportal24.test/de/newsrooms')->assertSeeText('Einmalig AG');
|
||||
|
||||
app(PressReleaseService::class)->archive($release);
|
||||
|
||||
$this->get($url)->assertNotFound();
|
||||
$this->get('https://businessportal24.test/de/newsrooms')->assertDontSeeText('Einmalig AG');
|
||||
});
|
||||
|
||||
test('an admin status change away from published takes the newsroom page down', function () {
|
||||
/** @var TestCase $this */
|
||||
$company = makeNewsroom('Rückzug GmbH');
|
||||
$release = publishForCompany($company, 'Zurückgezogen');
|
||||
$url = 'https://businessportal24.test/de/newsroom/'.$company->slug;
|
||||
|
||||
$this->get($url)->assertOk();
|
||||
|
||||
app(PressReleaseService::class)->changeStatusFromAdmin($release, PressReleaseStatus::Draft);
|
||||
|
||||
$this->get($url)->assertNotFound();
|
||||
});
|
||||
|
||||
test('deleting the last published release from admin takes the newsroom page down', function () {
|
||||
/** @var TestCase $this */
|
||||
$company = makeNewsroom('Gelöscht KG');
|
||||
$release = publishForCompany($company, 'Wird entfernt');
|
||||
$url = 'https://businessportal24.test/de/newsroom/'.$company->slug;
|
||||
|
||||
$this->get($url)->assertOk();
|
||||
|
||||
app(PressReleaseService::class)->deleteFromAdmin($release);
|
||||
|
||||
$this->get($url)->assertNotFound();
|
||||
});
|
||||
|
||||
test('the newsrooms pages are available per edition and portal', function () {
|
||||
/** @var TestCase $this */
|
||||
$this->get('https://businessportal24.test/en/newsrooms')->assertSuccessful();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue