From 5c293219f3a950f8a2eecec1ebea50ea58e2d055 Mon Sep 17 00:00:00 2001 From: Eli Ribble Date: Thu, 29 Aug 2024 10:47:09 -0700 Subject: [PATCH] Add 'from' and 'received at' to the email summary. Really useful in deciding what to read. --- src/EmailSummary.tsx | 9 +++++++-- src/client/Client.tsx | 10 +++++++++- src/client/types.tsx | 2 ++ 3 files changed, 18 insertions(+), 3 deletions(-) diff --git a/src/EmailSummary.tsx b/src/EmailSummary.tsx index f777e4a..0e57c1e 100644 --- a/src/EmailSummary.tsx +++ b/src/EmailSummary.tsx @@ -48,11 +48,16 @@ class EmailSummary extends React.Component< this.props.mailbox.id + "/" + this.props.emailId; + const stub = this.props.emailStub; return (
- {this.props.emailStub != null - ? this.props.emailStub.subject + {stub != null + ? stub.receivedAt + + " - " + + (stub.from == null ? "?" : stub.from[0].name) + + " - " + + stub.subject : this.props.emailId}
diff --git a/src/client/Client.tsx b/src/client/Client.tsx index cc22889..2ed7158 100644 --- a/src/client/Client.tsx +++ b/src/client/Client.tsx @@ -148,7 +148,7 @@ export default class Client { .email_get({ accountId: accountId, ids: [emailId], - properties: ["subject"], + properties: ["from", "receivedAt", "subject"], }) .then((response) => { console.log(msg, "response", response); @@ -161,7 +161,9 @@ export default class Client { ); } this.state.session.emailStubs[e.id] = { + from: e.from, id: e.id, + receivedAt: e.receivedAt, subject: e.subject, }; this._triggerChange(msg + e.id); @@ -181,6 +183,12 @@ export default class Client { .email_query({ accountId: accountId, filter: { inMailbox: mailboxId }, + sort: [ + { + property: "receivedAt", + isAscending: false, + }, + ], }) .then((response) => { const mailbox = this.mailbox(accountId, mailboxId); diff --git a/src/client/types.tsx b/src/client/types.tsx index 3906350..da345c1 100644 --- a/src/client/types.tsx +++ b/src/client/types.tsx @@ -1,7 +1,9 @@ import client from "jmap-client-ts/lib/types"; export interface IEmailStub { + from: Array | null; id: string; + receivedAt: string; subject: string; }