feat: use email 'Date' header for statistics and search filtering #87

This commit is contained in:
rustmailer
2025-12-30 22:21:53 +08:00
parent fb0be8c5d1
commit 7fb6575f8d
4 changed files with 15 additions and 15 deletions
+3 -3
View File
@@ -104,7 +104,7 @@ function CustomLabel({
alignItems: 'center',
}}
>
<FolderIcon className="mr-2"/>
<FolderIcon className="mr-2" />
<span className="font-medium text-sm text-inherit">
{children}
</span>
@@ -354,8 +354,8 @@ export function Mail({
<MailList
isLoading={isMessagesLoading}
items={(envelopes?.items ?? []).sort((a, b) => {
const dateA = a.internal_date;
const dateB = b.internal_date;
const dateA = a.date;
const dateB = b.date;
return dateB - dateA;
})}
/>
@@ -116,11 +116,11 @@ export function MailThreadDialog({ open, onOpenChange }: MailThreadDialogProps)
)}
{allMessages
.sort((a, b) => a.internal_date - b.internal_date)
.sort((a, b) => a.date - b.date)
.map((msg) => {
const isExpanded = expandedIds.has(msg.id);
const preview = msg.text?.slice(0, 120) + (msg.text?.length > 120 ? '...' : '');
const date = new Date(msg.internal_date);
const date = new Date(msg.date);
const formattedDate = isNaN(date.getTime())
? t('mailbox.thread.invalidDate')
: format(date, 'yyyy-MM-dd HH:mm:ss');
+2 -2
View File
@@ -113,13 +113,13 @@ export function MailThreadDialog({ open, onOpenChange }: MailThreadDialogProps)
)}
{allMessages
.sort((a, b) => a.internal_date - b.internal_date)
.sort((a, b) => a.date - b.date)
.map((msg) => {
const isExpanded = expandedIds.has(msg.id);
const preview =
msg.text?.slice(0, 120) +
(msg.text?.length > 120 ? '...' : '');
const date = new Date(msg.internal_date);
const date = new Date(msg.date);
const formattedDate = isNaN(date.getTime())
? t('search.thread.invalidDate')
: format(date, 'yyyy-MM-dd HH:mm:ss');