Leite Programmvorschauen ueber die Queue ab und seede den Testbestand nicht erneut
Deploy Test / test (push) Successful in 18s
Deploy Test / deploy (push) Successful in 22s

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
LarsandCursor committed 2026-11-16 10:01:13 +01:00
1 parent 295f784703
commit 57802dfe48
4 files changed
+51 -10

No files matched your search

@@ -25,6 +25,7 @@
use App\Filament\Resources\Exercises\ExerciseResource;
use App\Filament\Support\CatalogOptions;
use App\Filament\Support\CatalogReading;
use App\Jobs\DeriveThumbnail;
use App\Models\User;
use Filament\Actions\Action;
use Filament\Facades\Filament;
@@ -240,11 +241,7 @@ protected function handleRecordUpdate(Model $record, array $data): Model
? (int) $data['editorial_content_kind_id']
: null;
}
if (is_string($data['thumbnail_upload'] ?? null) && $data['thumbnail_upload'] !== '') {
$record->thumbnail_path = $data['thumbnail_upload'];
$record->thumbnail_error = null;
$record->thumbnail_alt = $record->designation;
}
$thumbnail = is_string($data['thumbnail_upload'] ?? null) ? $data['thumbnail_upload'] : '';
$record->save();
if (array_key_exists('dimension_ids', $data)) {
$this->syncDimensions($record, array_map(intval(...), $data['dimension_ids'] ?? []));
@@ -285,6 +282,10 @@ protected function handleRecordUpdate(Model $record, array $data): Model
} else {
$this->savedTitle = 'Bezeichnung und Art sind gespeichert. Die Bausteine sind unverändert, deshalb gibt es keine neue Fassung.';
}
if ($thumbnail !== '') {
DeriveThumbnail::dispatch('komposition', $record->id, $thumbnail);
}
} catch (DomainRuleException $exception) {
Notification::make()->title($exception->getMessage())->danger()->send();
+1 -1
View File
@@ -13,7 +13,7 @@ ## Ablauf
- Der Deploy-Job hat `needs: test`. Sind die Tests rot, läuft kein Deploy.
- Deployt wird der getestete Commit (`github.sha`), nicht der jeweils neueste Stand des Branches.
- `scripts/deploy.sh`: Konfigurationsprüfung, Portkonflikt-Prüfung, Build, DB starten, `migrate --force`, Start, Health (`/up` und Datenbankzugriff). Bei Fehler Rollback auf den letzten erfolgreichen Image-Tag (`.last_good_tag`).
- `scripts/deploy.sh`: Konfigurationsprüfung, Portkonflikt-Prüfung, Build, DB starten, `migrate --force`, Start, Health (`/up` und Datenbankzugriff). Bei Fehler Rollback auf den letzten erfolgreichen Image-Tag (`.last_good_tag`). Der Deploy legt keinen Demokatalog an. `DemoCatalogSeeder` bleibt für die Testsuite; der Bestand der Testinstanz wird in der Verwaltung gepflegt.
- Ein Deploy gleichzeitig pro Host (`flock`), alte Images werden bis auf die letzten Tags entfernt.
- **Rollback betrifft nur den Code.** Migrationen werden nicht zurückgenommen. Migrationen müssen daher abwärtskompatibel sein (erst ergänzen, später entfernen).
-4
View File
@@ -111,10 +111,6 @@ deploy() {
wait_for_db || return 1
echo "=== Migrationen ==="
dc run --rm --no-deps -T app php artisan migrate --force || return 1
if [ "$LUF_ENV" = test ]; then
dc run --rm --no-deps -T app php artisan db:seed --class=Database\\Seeders\\DemoCatalogSeeder --force || return 1
echo "✓ Testdaten geprüft"
fi
echo "=== Start ==="
dc up -d --remove-orphans || return 1
wait_for_web || return 1
+44
View File
@@ -156,6 +156,50 @@ public function test_an_exercise_can_gain_and_drop_a_medium_without_losing_the_o
$this->assertSame(3, $exercise->composition->versions()->count());
}
public function test_a_composition_preview_is_derived_without_a_new_version(): void
{
Storage::fake('cms_incoming');
Storage::fake('media_derived');
$image = imagecreatetruecolor(8, 8);
ob_start();
imagepng($image);
$png = ob_get_clean();
imagedestroy($image);
Storage::disk('cms_incoming')->put('vorschau/karte.png', $png);
$content = app(ContentService::class);
$sheet = $content->publishElementVersion(
$content->createElement('text', 'text', 'Blatt'),
'Text',
);
$exercise = $content->publishComposition(
$content->createComposition('Alltag üben'),
[['role' => 'Blatt', 'target' => $sheet]],
);
$editor = User::factory()->redakteur()->create();
$editor->saveAppAuthenticationSecret('JBSWY3DPEHPK3PXP');
$this->actingAs($editor, 'staff');
Livewire::test(EditExercise::class, ['record' => $exercise->composition_id])
->fillForm([
'designation' => 'Alltag üben',
'kind' => 'uebung',
'members' => [
['role' => 'Blatt', 'target' => 'element:'.$sheet->id],
],
'thumbnail_upload' => ['vorschau/karte.png'],
])
->call('save')
->assertHasNoFormErrors();
$composition = $exercise->composition->fresh();
$this->assertSame(1, $composition->versions()->count());
$this->assertSame('vorschau/komposition-'.$composition->id.'.jpg', $composition->thumbnail_path);
Storage::disk('media_derived')->assertExists($composition->thumbnail_path);
$this->assertNull($composition->thumbnail_error);
}
public function test_a_catalog_keeper_cannot_edit_media(): void
{
$element = app(ContentService::class)->createElement('text', 'text', 'Hinweis');