From 624fb681a8ceeceecb898627503bf6cf73c2c6e8 Mon Sep 17 00:00:00 2001 From: Robin Jarry Date: Tue, 4 Jul 2023 12:18:55 +0200 Subject: compose: only allow setting content at creation Add a parameter for the initial value of the body to be inserted *before* the signature when composing a message. Make AppendContents and SetContents private methods to ensure there is no other way to change the composer contents from the outside after creation. Signed-off-by: Robin Jarry Tested-by: Bence Ferdinandy Tested-by: Koni Marti --- commands/account/compose.go | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) (limited to 'commands/account/compose.go') diff --git a/commands/account/compose.go b/commands/account/compose.go index a8b16791..3c603f34 100644 --- a/commands/account/compose.go +++ b/commands/account/compose.go @@ -11,7 +11,6 @@ import ( "github.com/emersion/go-message/mail" "git.sr.ht/~rjarry/aerc/config" - "git.sr.ht/~rjarry/aerc/log" "git.sr.ht/~rjarry/aerc/widgets" "git.sr.ht/~sircmpwn/getopt" ) @@ -53,16 +52,11 @@ func (Compose) Execute(aerc *widgets.Aerc, args []string) error { composer, err := widgets.NewComposer(aerc, acct, acct.AccountConfig(), acct.Worker(), - template, &headers, nil) + template, &headers, nil, msg.Body) if err != nil { return err } composer.Tab = aerc.NewTab(composer, "New email") - go func() { - defer log.PanicHandler() - - composer.AppendContents(msg.Body) - }() return nil } -- cgit