mirror of
https://github.com/suitenumerique/messages.git
synced 2026-08-17 21:25:41 +02:00
✨(download) add raw email download button
This commit is contained in:
@@ -99,6 +99,7 @@
|
||||
"Domain admin": "Domain admin",
|
||||
"Domain not found": "Domain not found",
|
||||
"Download": "Download",
|
||||
"Download raw email": "Download raw email",
|
||||
"Draft": "Draft",
|
||||
"Draft deleted": "Draft deleted",
|
||||
"Draft saved": "Draft saved",
|
||||
|
||||
@@ -99,6 +99,7 @@
|
||||
"Domain admin": "Gestion des domaines",
|
||||
"Domain not found": "Domaine introuvable",
|
||||
"Download": "Télécharger",
|
||||
"Download raw email": "Télécharger l'email brut",
|
||||
"Draft": "Brouillon",
|
||||
"Draft deleted": "Brouillon supprimé",
|
||||
"Draft saved": "Brouillon enregistré",
|
||||
|
||||
+15
@@ -15,6 +15,8 @@ import { MessageFormMode } from "@/features/forms/components/message-form";
|
||||
import MailHelper from "@/features/utils/mail-helper";
|
||||
import useAbility, { Abilities } from "@/hooks/use-ability";
|
||||
import { ContactChip } from "@/features/ui/components/contact-chip";
|
||||
import { getMessagesEmlRetrieveUrl } from "@/features/api/gen/messages/messages";
|
||||
import { getRequestUrl } from "@/features/api/utils";
|
||||
|
||||
type ThreadMessageProps = {
|
||||
message: Message,
|
||||
@@ -158,6 +160,19 @@ export const ThreadMessage = forwardRef<HTMLElement, ThreadMessageProps>(
|
||||
icon: <span className="material-icons">mark_email_unread</span>,
|
||||
callback: () => markAsUnreadFrom(message.id)
|
||||
},
|
||||
{
|
||||
label: t('Download raw email'),
|
||||
icon: <span className="material-icons">download</span>,
|
||||
callback: () => {
|
||||
const downloadUrl = getRequestUrl(getMessagesEmlRetrieveUrl(message.id));
|
||||
const link = document.createElement('a');
|
||||
link.href = downloadUrl;
|
||||
link.download = `message-${message.id}.eml`;
|
||||
document.body.appendChild(link);
|
||||
link.click();
|
||||
document.body.removeChild(link);
|
||||
}
|
||||
},
|
||||
...(message.is_trashed ? [] : [{
|
||||
label: t('Delete'),
|
||||
icon: <span className="material-icons">delete</span>,
|
||||
|
||||
Reference in New Issue
Block a user