Add 'from' and 'received at' to the email summary.

Really useful in deciding what to read.
This commit is contained in:
Eli Ribble 2024-08-29 10:47:09 -07:00
parent d71f18cce1
commit 5c293219f3
3 changed files with 18 additions and 3 deletions

View File

@ -48,11 +48,16 @@ class EmailSummary extends React.Component<
this.props.mailbox.id + this.props.mailbox.id +
"/" + "/" +
this.props.emailId; this.props.emailId;
const stub = this.props.emailStub;
return ( return (
<div className="p-2 border" key={this.props.emailId}> <div className="p-2 border" key={this.props.emailId}>
<a className="btn" href={href}> <a className="btn" href={href}>
{this.props.emailStub != null {stub != null
? this.props.emailStub.subject ? stub.receivedAt +
" - " +
(stub.from == null ? "?" : stub.from[0].name) +
" - " +
stub.subject
: this.props.emailId} : this.props.emailId}
</a> </a>
</div> </div>

View File

@ -148,7 +148,7 @@ export default class Client {
.email_get({ .email_get({
accountId: accountId, accountId: accountId,
ids: [emailId], ids: [emailId],
properties: ["subject"], properties: ["from", "receivedAt", "subject"],
}) })
.then((response) => { .then((response) => {
console.log(msg, "response", response); console.log(msg, "response", response);
@ -161,7 +161,9 @@ export default class Client {
); );
} }
this.state.session.emailStubs[e.id] = { this.state.session.emailStubs[e.id] = {
from: e.from,
id: e.id, id: e.id,
receivedAt: e.receivedAt,
subject: e.subject, subject: e.subject,
}; };
this._triggerChange(msg + e.id); this._triggerChange(msg + e.id);
@ -181,6 +183,12 @@ export default class Client {
.email_query({ .email_query({
accountId: accountId, accountId: accountId,
filter: { inMailbox: mailboxId }, filter: { inMailbox: mailboxId },
sort: [
{
property: "receivedAt",
isAscending: false,
},
],
}) })
.then((response) => { .then((response) => {
const mailbox = this.mailbox(accountId, mailboxId); const mailbox = this.mailbox(accountId, mailboxId);

View File

@ -1,7 +1,9 @@
import client from "jmap-client-ts/lib/types"; import client from "jmap-client-ts/lib/types";
export interface IEmailStub { export interface IEmailStub {
from: Array<client.IEmailAddress> | null;
id: string; id: string;
receivedAt: string;
subject: string; subject: string;
} }