Sichere den Redaktions-Arbeitsstand ab und entferne den Parallel-Editor.
- Speichern löst nur Zuordnungen, die beim Laden da waren; zwischenzeitlich
anderswo ergänzte bleiben erhalten.
- Eine belegte Einzelrolle (Titelbild, Hero, Hover) wird im Picker
ausdrücklich ausgetauscht, mit Banner und benanntem Ersatz.
- Gemeinsamer Bestätigungsdialog statt Browser-confirm(); Warnung beim
Verlassen der Seite mit ungespeicherten Änderungen.
- „Ausgabe prüfen“ am Medium benennt, welche Angaben aktuell und welche
gespeichert sind.
- Das frühere Gesamtformular für Medien leitet in die Redaktion; „Löschen“
steht unter „Weitere Aktionen“, die Medienliste öffnet die Redaktion.
- Vorschaubild aus vorhandenem Bild wieder über den gemeinsamen Picker
wählbar (Oberfläche war seit 72130d6 entfallen).
- Vorgemerkte Upload-Dateien bleiben sichtbar, Brotkrumen führen zur Liste,
die Redaktion lässt sich über die Adresse nicht ohne Recht öffnen.
- Agentenregeln und CLAUDE.md verweisen auf die gemeinsamen Bausteine.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
872f156d7d
commit
e7b0932e54
21 files changed
+481
-47
No files matched your search
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace Tests\Feature;
|
||||
|
||||
use App\Domain\Catalog\ArticleService;
|
||||
use App\Domain\Catalog\CompositionKind;
|
||||
use App\Domain\Catalog\ContentElement;
|
||||
use App\Domain\Catalog\ContentService;
|
||||
@@ -10,6 +11,8 @@
|
||||
use App\Domain\Catalog\PresentationMedia;
|
||||
use App\Filament\Resources\ContentElements\Pages\ViewContentElement;
|
||||
use App\Filament\Resources\Exercises\Pages\EditExercise;
|
||||
use App\Filament\Resources\LicenseArticles\LicenseArticleResource;
|
||||
use App\Filament\Resources\LicenseArticles\Pages\ViewLicenseArticle;
|
||||
use App\Models\User;
|
||||
use Filament\Facades\Filament;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
@@ -27,6 +30,141 @@ protected function setUp(): void
|
||||
Filament::setCurrentPanel(Filament::getPanel('verwaltung'));
|
||||
}
|
||||
|
||||
public function test_saving_keeps_an_assignment_that_someone_else_added_meanwhile(): void
|
||||
{
|
||||
$film = $this->film();
|
||||
$mine = $this->picture('Meine Galerie');
|
||||
$theirs = $this->picture('Fremde Galerie');
|
||||
|
||||
$page = Livewire::actingAs($this->editor(), 'staff')
|
||||
->test(ViewContentElement::class, ['record' => $film->getKey()])
|
||||
->call('openRedaktion', 'medien');
|
||||
|
||||
app(PresentationMedia::class)->assign($film, 'galerie', $theirs->id, null);
|
||||
|
||||
$page->call('openPresentationPicker', 'galerie')
|
||||
->call('assignFromPicker', 'medium:'.$mine->id)
|
||||
->call('saveRedaktion');
|
||||
|
||||
$this->assertEqualsCanonicalizing([$theirs->id, $mine->id], $this->order($film, 'galerie'));
|
||||
}
|
||||
|
||||
public function test_adding_to_an_occupied_single_role_is_an_exchange(): void
|
||||
{
|
||||
$film = $this->film();
|
||||
$old = $this->picture('Altes Titelbild');
|
||||
$new = $this->picture('Neues Titelbild');
|
||||
app(PresentationMedia::class)->assign($film, 'titelbild', $old->id, null);
|
||||
|
||||
Livewire::actingAs($this->editor(), 'staff')
|
||||
->test(ViewContentElement::class, ['record' => $film->getKey()])
|
||||
->call('openRedaktion', 'medien')
|
||||
->call('openPresentationPicker', 'titelbild')
|
||||
->assertSee('Wird ersetzt')
|
||||
->assertSee('Diese Rolle hat nur ein Medium.')
|
||||
->call('markPicker', 'medium:'.$new->id, true)
|
||||
->assertSee('Austauschen')
|
||||
->call('confirmPicker')
|
||||
->assertSee('„Neues Titelbild“ ersetzt „Altes Titelbild“ an derselben Stelle')
|
||||
->call('saveRedaktion');
|
||||
|
||||
$this->assertSame([$new->id], $this->order($film, 'titelbild'));
|
||||
$this->assertNotNull($old->fresh());
|
||||
}
|
||||
|
||||
public function test_a_stock_image_can_become_the_preview_image_through_the_shared_picker(): void
|
||||
{
|
||||
$film = $this->film();
|
||||
$image = $this->picture('Szenenbild');
|
||||
|
||||
Livewire::actingAs($this->editor(), 'staff')
|
||||
->test(ViewContentElement::class, ['record' => $film->getKey()])
|
||||
->call('openThumbnailPicker')
|
||||
->assertSee('Vorschaubild aus dem Bestand')
|
||||
->assertSee('Szenenbild')
|
||||
->call('markPicker', 'medium:'.$image->id, true)
|
||||
->assertSee('Als Vorschaubild übernehmen')
|
||||
->call('confirmPicker')
|
||||
->assertSet('pickerOpen', false)
|
||||
->assertSet('pictureFeedback', 'Vorschaubild übernommen. Es gibt keine neue Fassung. Für die Website ist es damit nicht freigegeben.');
|
||||
|
||||
$this->assertSame($image->thumbnail_path, $film->fresh()->thumbnail_path);
|
||||
$this->assertSame(1, $film->fresh()->versions()->count());
|
||||
}
|
||||
|
||||
public function test_confirmations_use_the_shared_dialog_and_only_known_actions(): void
|
||||
{
|
||||
$film = $this->film();
|
||||
$film->teaser = 'Gespeichert';
|
||||
$film->save();
|
||||
|
||||
Livewire::actingAs($this->editor(), 'staff')
|
||||
->test(ViewContentElement::class, ['record' => $film->getKey()])
|
||||
->call('openRedaktion')
|
||||
->set('teaser', 'Offen')
|
||||
->call('askConfirmation', 'discardRedaktion')
|
||||
->assertSee('Änderungen der Redaktion verwerfen?')
|
||||
->call('cancelConfirmation')
|
||||
->assertSet('teaser', 'Offen')
|
||||
->call('askConfirmation', 'discardRedaktion')
|
||||
->call('confirmConfirmation')
|
||||
->assertSet('teaser', 'Gespeichert')
|
||||
->call('askConfirmation', 'saveRedaktionTexte')
|
||||
->assertSet('bestaetigung', null);
|
||||
}
|
||||
|
||||
public function test_only_editors_change_the_redaktion_and_the_address_does_not_bypass_it(): void
|
||||
{
|
||||
$film = $this->film();
|
||||
$keeper = User::factory()->katalogverwalter()->create();
|
||||
$keeper->saveAppAuthenticationSecret('JBSWY3DPEHPK3PXP');
|
||||
|
||||
Livewire::actingAs($keeper, 'staff')
|
||||
->withQueryParams(['redaktion' => '1'])
|
||||
->test(ViewContentElement::class, ['record' => $film->getKey()])
|
||||
->assertSet('redaktionOpen', false)
|
||||
->assertDontSee('Redaktion bearbeiten')
|
||||
->call('saveRedaktion')
|
||||
->assertForbidden();
|
||||
|
||||
foreach (['removePresentation' => ['a1'], 'confirmPicker' => [], 'openPresentationPicker' => []] as $method => $arguments) {
|
||||
Livewire::actingAs($keeper, 'staff')
|
||||
->test(ViewContentElement::class, ['record' => $film->getKey()])
|
||||
->set('pickerMarked', ['medium:1' => 'x'])
|
||||
->call($method, ...$arguments)
|
||||
->assertForbidden();
|
||||
}
|
||||
|
||||
$this->assertSame(0, PresentationAssignment::query()->count());
|
||||
}
|
||||
|
||||
public function test_the_license_article_needs_the_catalog_role_and_offers_no_global_release_there(): void
|
||||
{
|
||||
$content = app(ContentService::class);
|
||||
$film = $this->film();
|
||||
$version = $film->versions()->first();
|
||||
$articles = app(ArticleService::class);
|
||||
$article = $articles->create('LARA-PARK', 'Alltag');
|
||||
$articles->publishRelease($article, $version, 'Derselbe Unterrichtsfilm');
|
||||
$image = $this->picture('Artikelbild');
|
||||
app(PresentationMedia::class)->assign($article, 'titelbild', $image->id, null);
|
||||
|
||||
$this->actingAs($this->editor(), 'staff')
|
||||
->get(LicenseArticleResource::getUrl('view', ['record' => $article]))
|
||||
->assertForbidden();
|
||||
|
||||
$keeper = User::factory()->katalogverwalter()->create();
|
||||
$keeper->saveAppAuthenticationSecret('JBSWY3DPEHPK3PXP');
|
||||
|
||||
Livewire::actingAs($keeper, 'staff')
|
||||
->test(ViewLicenseArticle::class, ['record' => $article->getKey()])
|
||||
->call('openRedaktion', 'medien')
|
||||
->assertSee('Artikelbild')
|
||||
->assertSee('Medium öffnen')
|
||||
->assertDontSee('Für die Website freigeben')
|
||||
->assertDontSee('Website-Freigabe zurücknehmen');
|
||||
}
|
||||
|
||||
public function test_redaktion_return_keeps_open_composition_inputs_and_saves_only_editorial_text(): void
|
||||
{
|
||||
$content = app(ContentService::class);
|
||||
@@ -247,7 +385,7 @@ public function test_exchange_keeps_the_position_and_reordering_stays_within_its
|
||||
->call('markPicker', 'medium:'.$replacement->id, true)
|
||||
->assertSee('Austauschen')
|
||||
->call('confirmPicker')
|
||||
->assertSee('ersetzt die bisherige Zuordnung an derselben Stelle')
|
||||
->assertSee('ersetzt „Bild zwei“ an derselben Stelle')
|
||||
->call('movePresentation', $keyOf($three), -1)
|
||||
->call('movePresentation', $keyOf($one), -1)
|
||||
->call('saveRedaktion');
|
||||
@@ -324,6 +462,15 @@ public function test_a_missing_working_title_is_shown_at_the_field_and_nothing_i
|
||||
$this->assertSame('Lara im Park', $film->fresh()->working_title);
|
||||
}
|
||||
|
||||
private function film(): ContentElement
|
||||
{
|
||||
$content = app(ContentService::class);
|
||||
$film = $content->createElement('film', 'film', 'Lara im Park');
|
||||
$content->publishElementVersion($film, 'Filmfassung');
|
||||
|
||||
return $film->fresh();
|
||||
}
|
||||
|
||||
private function picture(string $title): ContentElement
|
||||
{
|
||||
$image = app(ContentService::class)->createElement('bild', 'bild', $title);
|
||||
|
||||
Reference in new issue
Block a user