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/msg/invite.go | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'commands/msg/invite.go') diff --git a/commands/msg/invite.go b/commands/msg/invite.go index 774c4a69..6273d520 100644 --- a/commands/msg/invite.go +++ b/commands/msg/invite.go @@ -138,13 +138,11 @@ func (invite) Execute(aerc *widgets.Aerc, args []string) error { addTab := func(cr *calendar.Reply) error { composer, err := widgets.NewComposer(aerc, acct, - acct.AccountConfig(), acct.Worker(), "", h, &original) + acct.AccountConfig(), acct.Worker(), "", h, &original, cr.PlainText) if err != nil { aerc.PushError("Error: " + err.Error()) return err } - - composer.SetContents(cr.PlainText) err = composer.AppendPart(cr.MimeType, cr.Params, cr.CalendarText) if err != nil { return fmt.Errorf("failed to write invitation: %w", err) -- cgit