From f16b105d2607c5435481275a8d9bf84c77db1466 Mon Sep 17 00:00:00 2001 From: Ralph Slooten Date: Fri, 31 Mar 2023 23:34:59 +1300 Subject: [PATCH] API: Include Reply-To in message summary (including Web UI) This adds a new ReplyTo array to to API Message response, and displays in the web UI if set. See #66 --- docs/apiv1/Message.md | 3 ++- server/ui-src/templates/Message.vue | 26 ++++++++++++++++++-------- server/ui/api/v1/swagger.json | 7 +++++++ storage/database.go | 1 + storage/structs.go | 2 ++ 5 files changed, 30 insertions(+), 9 deletions(-) diff --git a/docs/apiv1/Message.md b/docs/apiv1/Message.md index 5cf47b5..d40c36e 100644 --- a/docs/apiv1/Message.md +++ b/docs/apiv1/Message.md @@ -28,6 +28,7 @@ Returns a JSON summary of the message and attachments. ], "Cc": [], "Bcc": [], + "ReplyTo": [], "Subject": "Message subject", "Date": "2016-09-07T16:46:00+13:00", "Text": "Plain text MIME part of the email", @@ -57,7 +58,7 @@ Returns a JSON summary of the message and attachments. - `Read` - always true (message marked read on open) - `From` - Name & Address, or null -- `To`, `CC`, `BCC` - Array of Names & Address +- `To`, `CC`, `BCC`, `ReplyTo` - Array of Names & Address - `Date` - Parsed email local date & time from headers - `Size` - Total size of raw email - `Inline`, `Attachments` - Array of attachments and inline images. diff --git a/server/ui-src/templates/Message.vue b/server/ui-src/templates/Message.vue index 8bcc22f..880cc60 100644 --- a/server/ui-src/templates/Message.vue +++ b/server/ui-src/templates/Message.vue @@ -147,12 +147,14 @@ export default {
- - + + @@ -174,7 +176,7 @@ export default { @@ -182,7 +184,15 @@ export default { + + + + diff --git a/server/ui/api/v1/swagger.json b/server/ui/api/v1/swagger.json index def408a..d67e95b 100644 --- a/server/ui/api/v1/swagger.json +++ b/server/ui/api/v1/swagger.json @@ -586,6 +586,13 @@ "description": "Read status", "type": "boolean" }, + "ReplyTo": { + "description": "ReplyTo addresses", + "type": "array", + "items": { + "$ref": "#/definitions/Address" + } + }, "Size": { "description": "Message size in bytes", "type": "integer", diff --git a/storage/database.go b/storage/database.go index 21e71fb..d08899a 100644 --- a/storage/database.go +++ b/storage/database.go @@ -442,6 +442,7 @@ func GetMessage(id string) (*Message, error) { To: addressToSlice(env, "To"), Cc: addressToSlice(env, "Cc"), Bcc: addressToSlice(env, "Bcc"), + ReplyTo: addressToSlice(env, "Reply-To"), Subject: env.GetHeader("Subject"), Tags: getMessageTags(id), Size: len(raw), diff --git a/storage/structs.go b/storage/structs.go index 733614a..7d61f78 100644 --- a/storage/structs.go +++ b/storage/structs.go @@ -23,6 +23,8 @@ type Message struct { Cc []*mail.Address // Bcc addresses Bcc []*mail.Address + // ReplyTo addresses + ReplyTo []*mail.Address // Message subject Subject string // Message date if set, else date received
From
From {{ message.From.Name + " " }} - <{{ message.From.Address }}> + + <{{ message.From.Address }}> + [ Unknown ] @@ -164,9 +166,9 @@ export default { - {{ t.Name + " <" + t.Address + ">" }} - - Undisclosed recipients + {{ t.Name + " <" + t.Address + ">" }} + + Undisclosed recipients
- {{ t.Name + " <" + t.Address + ">" }} + {{ t.Name + " <" + t.Address + ">" }}
- {{ t.Name + " <" + t.Address + ">" }} + {{ t.Name + " <" + t.Address + ">" }} +
Reply-To + + + {{ t.Name + " <" + t.Address + ">" }}