fix(files): show legacy file warning banner for trusted-access users
Trusted-access users (Pres Mgmt admins) were getting file_list_status='ready' when selecting .ppt/.doc/.xls files, so the prominent warning banner never rendered — only the small per-row warning in the file table was visible. - element_input_files_tbl: introduce 'warn_legacy' status for trusted users; show a yellow warning banner (vs red blocked banner for non-trusted users) - ae_comp__event_files_upload: change button disabled check from != 'ready' to === 'blocked_legacy' so 'warn_legacy' does not accidentally block upload Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -280,7 +280,15 @@ async function process_file_list(file_list: FileList) {
|
||||
}
|
||||
|
||||
const has_blocked = processed_file_list.some((f) => f.block_upload);
|
||||
file_list_status = has_blocked && !$ae_loc.trusted_access ? 'blocked_legacy' : 'ready';
|
||||
// WHY: trusted_access users (Pres Mgmt admins) see a prominent warning but are
|
||||
// not blocked from uploading — they may intentionally handle legacy formats.
|
||||
// Non-trusted users are fully blocked. Both cases get a visible banner; only
|
||||
// the color and button state differ.
|
||||
if (has_blocked) {
|
||||
file_list_status = $ae_loc.trusted_access ? 'warn_legacy' : 'blocked_legacy';
|
||||
} else {
|
||||
file_list_status = 'ready';
|
||||
}
|
||||
console.log(processed_file_list);
|
||||
|
||||
// return JSON.parse(JSON.stringify(processed_file_list));
|
||||
@@ -376,6 +384,13 @@ run(() => {
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
{#if file_list_status == 'warn_legacy'}
|
||||
<div class="m-1 rounded-md border-2 border-yellow-500 bg-yellow-50 p-3 text-sm text-yellow-900 dark:bg-yellow-900/30 dark:text-yellow-200">
|
||||
<strong>⚠ Warning — legacy file format detected.</strong>
|
||||
This Microsoft file type has not been supported in more than 10 years and may not work well. You can still upload, but it is strongly recommended to re-save in the modern format first. See details below.
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
<!-- {#await processed_file_list} -->
|
||||
<!-- {:then} -->
|
||||
{#if use_selected_file_table && processed_file_list && processed_file_list.length}
|
||||
|
||||
@@ -279,7 +279,7 @@ async function handle_input_upload_files({
|
||||
transition-all
|
||||
"
|
||||
disabled={$events_sess.files.disable_submit__event_file_obj ||
|
||||
$events_sess.files.status__file_list != 'ready'}>
|
||||
$events_sess.files.status__file_list === 'blocked_legacy'}>
|
||||
{#await ae_promises.upload__hosted_file_obj}
|
||||
<LoaderCircle class="m-1 animate-spin" />
|
||||
<span class="">
|
||||
|
||||
Reference in New Issue
Block a user