mirror of
https://github.com/suitenumerique/messages.git
synced 2026-09-30 13:45:00 +02:00
🐛(frontend) exclude Drive files of the attachment total size limit
Drive file are currently taken in account to compute the attachment total size to know it the size limit has been reached. But actually we only want to take in account the local attachments.
This commit is contained in:
@@ -136,7 +136,6 @@
|
||||
"Failed to refresh summary.": "Failed to refresh summary.",
|
||||
"Failed to save template. Please try again.": "Failed to save template. Please try again.",
|
||||
"Feedback?": "Feedback?",
|
||||
"File too large": "File too large",
|
||||
"First name": "First name",
|
||||
"First name is required.": "First name is required.",
|
||||
"First, we need some information about your old mailbox": "First, we need some information about your old mailbox",
|
||||
@@ -300,7 +299,6 @@
|
||||
"The domain <strong>{{domain}}</strong> has been created successfully.": "The domain <strong>{{domain}}</strong> has been created successfully.",
|
||||
"The email {{email}} is invalid.": "The email {{email}} is invalid.",
|
||||
"The email address is invalid.": "The email address is invalid.",
|
||||
"The file is too large. It must be less than {{size}}.": "The file is too large. It must be less than {{size}}.",
|
||||
"The forced signature will be the only one usable for new messages.": "The forced signature will be the only one usable for new messages.",
|
||||
"The message could not be sent.": "The message could not be sent.",
|
||||
"The message could not be sent. Please try again later.": "The message could not be sent. Please try again later.",
|
||||
|
||||
@@ -53,6 +53,7 @@
|
||||
"At least one recipient is required.": "Il faut au moins un destinataire.",
|
||||
"Attachment failed to be saved into your Drive's workspace.": "Impossible de sauvegarder la pièce jointe dans votre espace de travail Fichiers.",
|
||||
"Attachment saved into your Drive's workspace.": "Pièce jointe sauvegardée dans votre espace de travail Fichiers.",
|
||||
"Attachment size limit exceeded": "La taille des pièces jointes excède la limite autorisée.",
|
||||
"Attachments must be less than {{size}}.": "Les pièces jointes ne peuvent pas excéder {{size}}.",
|
||||
"Authentication failed. Please check your credentials and ensure you have enabled IMAP connections in your account.": "L'authentification a échoué. Veuillez vérifier vos identifiants et assurez-vous d'avoir autorisé les connexions IMAP dans votre compte.",
|
||||
"Auto-labeling": "Labellisation automatique",
|
||||
@@ -62,6 +63,7 @@
|
||||
"BCC: ": "CCI : ",
|
||||
"Blind copy: ": "Copie cachée : ",
|
||||
"Cancel": "Annuler",
|
||||
"Cannot add attachment(s). Total size would be more than {{maxSize}}.": "Impossible d'ajouter ces pièces jointes. La taille totale dépasserait la limite autorisée de {{maxSize}}.",
|
||||
"Check DNS again": "Revérifier les DNS",
|
||||
"Checking DNS records...": "Vérification des enregistrements DNS...",
|
||||
"Close": "Fermer",
|
||||
@@ -297,7 +299,6 @@
|
||||
"The domain <strong>{{domain}}</strong> has been created successfully.": "Le domaine <strong>{{domain}}</strong> a été créé avec succès.",
|
||||
"The email {{email}} is invalid.": "Le courriel {{email}} est invalide.",
|
||||
"The email address is invalid.": "L'adresse email est invalide.",
|
||||
"The file is too large. It must be less than {{size}}.": "Le fichier est trop volumineux. Il doit être inférieur à {{size}}.",
|
||||
"The forced signature will be the only one usable for new messages.": "La signature forcée sera la seule utilisable pour les nouveaux messages.",
|
||||
"The message could not be sent.": "Le message n'a pas pu être envoyé.",
|
||||
"The message could not be sent. Please try again later.": "Le message n'a pas pu être envoyé. Veuillez réessayer plus tard.",
|
||||
|
||||
@@ -5,7 +5,7 @@ import { useMailboxContext } from '@/features/providers/mailbox';
|
||||
import { useConfig } from '@/features/providers/config';
|
||||
import { useFormContext } from 'react-hook-form';
|
||||
import { Button, Field, useModals, VariantType } from '@openfun/cunningham-react';
|
||||
import { AttachmentItem } from '@/features/layouts/components/thread-view/components/thread-attachment-list/attachment-item';
|
||||
import { AttachmentItem, isAttachment } from '@/features/layouts/components/thread-view/components/thread-attachment-list/attachment-item';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { useDropzone } from 'react-dropzone';
|
||||
import { AttachmentHelper } from '@/features/utils/attachment-helper';
|
||||
@@ -39,7 +39,10 @@ export const AttachmentUploader = ({
|
||||
const debouncedOnChange = useDebounceCallback(onChange, 1000);
|
||||
|
||||
// Calculate current total size of attachments and pending uploads
|
||||
const attachmentsSize = attachments.reduce((acc, attachment) => acc + attachment.size, 0);
|
||||
const attachmentsSize = attachments.reduce((acc, attachment) => {
|
||||
if (isAttachment(attachment)) return acc + attachment.size;
|
||||
return acc;
|
||||
}, 0);
|
||||
const uploadingQueueSize = uploadingQueue.reduce((acc, file) => acc + file.size, 0);
|
||||
const currentTotalSize = attachmentsSize + uploadingQueueSize;
|
||||
|
||||
@@ -181,7 +184,9 @@ export const AttachmentUploader = ({
|
||||
? t("{{count}} attachments", { count: attachments.length, defaultValue_one: "{{count}} attachment" })
|
||||
: t("No attachments")}
|
||||
</strong>{' '}
|
||||
({AttachmentHelper.getFormattedTotalSize(attachments, i18n.resolvedLanguage)})
|
||||
{attachments.filter(isAttachment).length > 0 && (
|
||||
`(${AttachmentHelper.getFormattedTotalSize(attachments.filter(isAttachment), i18n.resolvedLanguage)})`
|
||||
)}
|
||||
</p>
|
||||
<div className="attachment-bucket__list">
|
||||
{failedQueue.map((entry) => (
|
||||
|
||||
+2
-2
@@ -19,10 +19,10 @@ type AttachmentItemProps = {
|
||||
onDelete?: () => void;
|
||||
}
|
||||
|
||||
const isAttachment = (attachment: Attachment | File | DriveFile): attachment is Attachment => {
|
||||
export const isAttachment = (attachment: Attachment | File | DriveFile): attachment is Attachment => {
|
||||
return 'blobId' in attachment;
|
||||
}
|
||||
const isDriveFile = (attachment: Attachment | File | DriveFile): attachment is DriveFile => {
|
||||
export const isDriveFile = (attachment: Attachment | File | DriveFile): attachment is DriveFile => {
|
||||
return 'url' in attachment;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user