Skip to content

Commit

Permalink
compose: copy to composing account's sent folder
Browse files Browse the repository at this point in the history
The composing account may be different than the currently selected
account if the user has moved between different tabs since beginning the
message.

Fixes: faa879f ("hooks: add mail-added hook")
Reported-by: Vitaly Ovchinnikov <[email protected]>
Signed-off-by: Jason Cox <[email protected]>
Acked-by: Robin Jarry <[email protected]>
Tested-by: Vitaly Ovchinnikov <[email protected]>
  • Loading branch information
jasonccox authored and rjarry committed Nov 22, 2023
1 parent 4120de1 commit 48b9589
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions commands/compose/send.go
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,8 @@ func send(composer *app.Composer, ctx sendCtx,
}
if ctx.copyto != "" && ctx.scheme != "jmap" {
app.PushStatus("Copying to "+ctx.copyto, 10*time.Second)
errch := copyToSent(ctx.copyto, copyBuf.Len(), &copyBuf)
errch := copyToSent(ctx.copyto, copyBuf.Len(), &copyBuf,
composer)
err = <-errch
if err != nil {
errmsg := fmt.Sprintf(
Expand Down Expand Up @@ -557,9 +558,9 @@ func newJmapSender(
return writer, err
}

func copyToSent(dest string, n int, msg io.Reader) <-chan error {
func copyToSent(dest string, n int, msg io.Reader, composer *app.Composer) <-chan error {
errCh := make(chan error, 1)
acct := app.SelectedAccount()
acct := composer.Account()
if acct == nil {
errCh <- errors.New("No account selected")
return errCh
Expand Down

0 comments on commit 48b9589

Please sign in to comment.