fix(compose): wait for in-flight attachment uploads before sending
Clicking Send while attachments were still uploading silently dropped them from the outgoing message: every place that builds the outgoing attachment list filters on att.blobId && !att.uploading, and the Send button never accounted for uploads still in flight. Attach a few files, hit Send right away, and the email could go out missing some of them with no warning. handleSend now detects pending uploads before validating: - Send is disabled with an explanatory tooltip (validation.attachments_uploading) while it waits. - Once uploads finish cleanly, the send proceeds automatically - no second click needed. - If an upload FAILS while waiting, the send is aborted with an error toast (validation.attachment_upload_failed) instead of silently shipping the email without the failed attachment - the user may not be looking at the composer to notice the red error chip. - If the draft is closed or discarded while waiting, the pending send is cancelled cleanly. The wait/decision logic lives in waitForPendingUploads() in lib/email-composer-utils.ts (returns completed | cancelled | failed) with unit tests covering all three outcomes. Outgoing-attachment call sites read the freshest state via attachmentsRef since the render closure captured at click time won't reflect uploads that finished during the wait. Both new i18n keys added to all 20 locales under email_composer.validation.
This commit is contained in:
@@ -632,7 +632,9 @@
|
||||
"validation": {
|
||||
"recipient_required": "Укажите получателя для отправки",
|
||||
"subject_required": "Укажите тему",
|
||||
"body_required": "Напишите сообщение или прикрепите файл"
|
||||
"body_required": "Напишите сообщение или прикрепите файл",
|
||||
"attachments_uploading": "Вложения ещё загружаются — отправка начнётся, как только загрузка завершится",
|
||||
"attachment_upload_failed": "Не отправлено — не удалось загрузить вложение. Удалите его и попробуйте снова."
|
||||
},
|
||||
"upload_progress": "Загрузка {uploaded} / {total}",
|
||||
"upload_cancel": "Отменить загрузку",
|
||||
|
||||
Reference in New Issue
Block a user