diff options
Diffstat (limited to 'plugins/base/routes.go')
-rw-r--r-- | plugins/base/routes.go | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/plugins/base/routes.go b/plugins/base/routes.go index 6ffdcf6..1f3b8b4 100644 --- a/plugins/base/routes.go +++ b/plugins/base/routes.go @@ -507,7 +507,7 @@ func submitCompose(ctx *alps.Context, msg *OutgoingMessage, options *composeOpti } err = ctx.Session.DoIMAP(func(c *imapclient.Client) error { - if _, err := appendMessage(c, msg, mailboxSent); err != nil { + if _, _, err := appendMessage(c, msg, mailboxSent); err != nil { return err } if draft := options.Draft; draft != nil { @@ -620,14 +620,15 @@ func handleCompose(ctx *alps.Context, msg *OutgoingMessage, options *composeOpti } if saveAsDraft { + var ( + drafts *MailboxInfo + uid uint32 + ) err = ctx.Session.DoIMAP(func(c *imapclient.Client) error { - copied, err := appendMessage(c, msg, mailboxDrafts) + drafts, uid, err = appendMessage(c, msg, mailboxDrafts) if err != nil { return err } - if !copied { - return fmt.Errorf("no Draft mailbox found") - } if draft := options.Draft; draft != nil { if err := deleteMessage(c, draft.Mailbox, draft.Uid); err != nil { return err @@ -638,7 +639,8 @@ func handleCompose(ctx *alps.Context, msg *OutgoingMessage, options *composeOpti if err != nil { return fmt.Errorf("failed to save message to Draft mailbox: %v", err) } - return ctx.Redirect(http.StatusFound, "/mailbox/INBOX") + return ctx.Redirect(http.StatusFound, fmt.Sprintf( + "/message/%s/%d/edit?part=1", drafts.Name, uid)) } else { return submitCompose(ctx, msg, options) } |