fix: load autosave-handler.js on about_page edit view, persist contact group deletion

Two fixes:

1. about_page edit was missing autosave-handler.js: the first if block
   (editType === 'page' || 'about_page') overrode $extraJs with only
   overtype.min.js, making the elseif that added autosave-handler.js
   unreachable for about_page. Added autosave-handler.js to the first
   block, removed dead 'about_page' from the elseif.

2. Deleting a contact group (Contacts 3/4/5) only removed the DOM
   element but never triggered htmx autosave. Dispatched a 'change'
   event on the form after removal+reindex so the hx-trigger fires.

Also expanded autosave-handler.js URL filter to accept apropos.php
so the status indicator (Enregistrement/Enregistré) works for contacts saves.
This commit is contained in:
Pontoporeia
2026-07-05 14:14:13 +02:00
parent 1e714982d3
commit 10df92b643
10 changed files with 54 additions and 38 deletions
+1 -1
View File
@@ -44,7 +44,7 @@ trait ThesisFileHandler
private const MAX_PDF_SIZE = 100 * 1024 * 1024; // 100 MB
/** Maximum allowed file size for video/audio files (bytes). */
private const MAX_AV_SIZE = 2 * 1024 * 1024 * 1024; // 2 GB
private const MAX_AV_SIZE = 5 * 1024 * 1024 * 1024; // 5 GB
/** Cover image max size. */
private const MAX_COVER_SIZE = 20 * 1024 * 1024; // 20 MB
@@ -105,10 +105,10 @@ $constraints = match ($fieldName) {
'mp3', 'ogg', 'oga', 'wav', 'flac', 'aac', 'm4a',
'vtt', 'zip', 'tar', 'gz', 'tgz',
],
'maxSize' => 500 * 1024 * 1024, // 500 MB
'maxSize' => 500 * 1024 * 1024, // 500 MB (default, overridden per-type below)
'label' => 'Fichier TFE',
'allowedDesc' => 'PDF, images, vidéos, audio, archives',
'maxSizeDesc' => '500 MB',
'maxSizeDesc' => '500 MB (5 GB pour vidéos/audio, 100 MB pour PDF)',
],
'annexes' => [
'mimes' => [
@@ -182,6 +182,14 @@ foreach ($allFiles as $idx => $f) {
continue;
}
// Per-type size override: video/audio up to 8 GB
$isAv = preg_match('/^(video|audio)\//', $mimeType)
|| in_array($ext, ['mp4','webm','ogv','mov','mp3','ogg','oga','wav','flac','aac','m4a']);
if ($isAv && $effMaxSize < 5 * 1024 * 1024 * 1024) {
$effMaxSize = 5 * 1024 * 1024 * 1024;
$effMaxDesc = '5 GB';
}
if ($size > $effMaxSize) {
$mb = round($size / 1024 / 1024, 1);
$errors[] = '✕ <em>' . htmlspecialchars($f['name']) . '</em> : fichier trop volumineux ('
+7 -7
View File
@@ -54,17 +54,17 @@ class FilepondHandler
public const QUEUE_SIZE_LIMITS = [
'cover' => 20 * 1024 * 1024, // 20 MB
'note_intention' => 100 * 1024 * 1024, // 100 MB
'tfe' => 1024 * 1024 * 1024, // 1 GB (default for non-AV, non-PDF)
'video' => 8 * 1024 * 1024 * 1024, // 8 GB
'audio' => 8 * 1024 * 1024 * 1024, // 8 GB
'annexe' => 1024 * 1024 * 1024, // 1 GB
'peertube_video' => 8 * 1024 * 1024 * 1024, // 8 GB
'peertube_audio' => 8 * 1024 * 1024 * 1024, // 8 GB
'tfe' => 500 * 1024 * 1024, // 500 MB (default for non-AV, non-PDF)
'video' => 5 * 1024 * 1024 * 1024, // 5 GB
'audio' => 5 * 1024 * 1024 * 1024, // 5 GB
'annexe' => 500 * 1024 * 1024, // 500 MB
'peertube_video' => 5 * 1024 * 1024 * 1024, // 5 GB
'peertube_audio' => 5 * 1024 * 1024 * 1024, // 5 GB
];
public const AV_EXTENSIONS = ['mp4', 'webm', 'ogv', 'mov', 'mp3', 'ogg', 'oga', 'wav', 'flac', 'aac', 'm4a'];
public const MAX_PDF_SIZE = 100 * 1024 * 1024; // 100 MB
public const MAX_AV_SIZE = 8 * 1024 * 1024 * 1024; // 8 GB
public const MAX_AV_SIZE = 5 * 1024 * 1024 * 1024; // 5 GB
// ── Log prefix for distinguishing admin vs partage ───────────────────────