aboutsummaryrefslogtreecommitdiffstats
path: root/commands
diff options
context:
space:
mode:
authorRobin Jarry <robin@jarry.cc>2022-12-20 17:05:43 +0100
committerRobin Jarry <robin@jarry.cc>2023-01-04 22:57:31 +0100
commitae675b491d2b55a06588e8ab4ce8205aaae796c8 (patch)
tree383920e34344ea3456162fb74cc180bfb33dec83 /commands
parent2a290cf1ed6113f0d01eea3f2cff446339bed0ce (diff)
downloadaerc-ae675b491d2b55a06588e8ab4ce8205aaae796c8.tar.gz
templates: change fields as lazy functions
No need to pre-render fields that are not necessarily accessed in templates. Change fields to functions that are evaluated only when required. Signed-off-by: Robin Jarry <robin@jarry.cc> Acked-by: Tim Culverhouse <tim@timculverhouse.com>
Diffstat (limited to 'commands')
-rw-r--r--commands/account/compose.go3
-rw-r--r--commands/account/recover.go3
-rw-r--r--commands/msg/forward.go2
-rw-r--r--commands/msg/invite.go2
-rw-r--r--commands/msg/recall.go2
-rw-r--r--commands/msg/reply.go3
-rw-r--r--commands/msg/unsubscribe.go3
7 files changed, 8 insertions, 10 deletions
diff --git a/commands/account/compose.go b/commands/account/compose.go
index fb37b231..5695bb7d 100644
--- a/commands/account/compose.go
+++ b/commands/account/compose.go
@@ -13,7 +13,6 @@ import (
"git.sr.ht/~rjarry/aerc/config"
"git.sr.ht/~rjarry/aerc/lib/ui"
"git.sr.ht/~rjarry/aerc/log"
- "git.sr.ht/~rjarry/aerc/models"
"git.sr.ht/~rjarry/aerc/widgets"
"git.sr.ht/~sircmpwn/getopt"
)
@@ -55,7 +54,7 @@ func (Compose) Execute(aerc *widgets.Aerc, args []string) error {
composer, err := widgets.NewComposer(aerc, acct,
acct.AccountConfig(), acct.Worker(),
- template, &headers, models.OriginalMail{})
+ template, &headers, nil)
if err != nil {
return err
}
diff --git a/commands/account/recover.go b/commands/account/recover.go
index 8ce878ee..cef0720f 100644
--- a/commands/account/recover.go
+++ b/commands/account/recover.go
@@ -10,7 +10,6 @@ import (
"git.sr.ht/~rjarry/aerc/commands"
"git.sr.ht/~rjarry/aerc/lib/ui"
"git.sr.ht/~rjarry/aerc/log"
- "git.sr.ht/~rjarry/aerc/models"
"git.sr.ht/~rjarry/aerc/widgets"
"git.sr.ht/~sircmpwn/getopt"
)
@@ -103,7 +102,7 @@ func (Recover) Execute(aerc *widgets.Aerc, args []string) error {
composer, err := widgets.NewComposer(aerc, acct,
acct.AccountConfig(), acct.Worker(),
- "", nil, models.OriginalMail{})
+ "", nil, nil)
if err != nil {
return err
}
diff --git a/commands/msg/forward.go b/commands/msg/forward.go
index 9a4f3d41..90c32ec2 100644
--- a/commands/msg/forward.go
+++ b/commands/msg/forward.go
@@ -101,7 +101,7 @@ func (forward) Execute(aerc *widgets.Aerc, args []string) error {
addTab := func() (*widgets.Composer, error) {
composer, err := widgets.NewComposer(aerc, acct,
- acct.AccountConfig(), acct.Worker(), template, h, original)
+ acct.AccountConfig(), acct.Worker(), template, h, &original)
if err != nil {
aerc.PushError("Error: " + err.Error())
return nil, err
diff --git a/commands/msg/invite.go b/commands/msg/invite.go
index ef28b91c..1528abea 100644
--- a/commands/msg/invite.go
+++ b/commands/msg/invite.go
@@ -139,7 +139,7 @@ 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)
if err != nil {
aerc.PushError("Error: " + err.Error())
return err
diff --git a/commands/msg/recall.go b/commands/msg/recall.go
index f106e8bd..2ef468e0 100644
--- a/commands/msg/recall.go
+++ b/commands/msg/recall.go
@@ -74,7 +74,7 @@ func (Recall) Execute(aerc *widgets.Aerc, args []string) error {
composer, err := widgets.NewComposer(aerc, acct,
acct.AccountConfig(), acct.Worker(), "", msgInfo.RFC822Headers,
- models.OriginalMail{})
+ nil)
if err != nil {
return errors.Wrap(err, "Cannot open a new composer")
}
diff --git a/commands/msg/reply.go b/commands/msg/reply.go
index 795158ca..f8cde644 100644
--- a/commands/msg/reply.go
+++ b/commands/msg/reply.go
@@ -175,7 +175,8 @@ func (reply) Execute(aerc *widgets.Aerc, args []string) error {
mv, _ := aerc.SelectedTabContent().(*widgets.MessageViewer)
addTab := func() error {
composer, err := widgets.NewComposer(aerc, acct,
- acct.AccountConfig(), acct.Worker(), template, h, original)
+ acct.AccountConfig(), acct.Worker(), template, h,
+ &original)
if err != nil {
aerc.PushError("Error: " + err.Error())
return err
diff --git a/commands/msg/unsubscribe.go b/commands/msg/unsubscribe.go
index a334e827..66797660 100644
--- a/commands/msg/unsubscribe.go
+++ b/commands/msg/unsubscribe.go
@@ -11,7 +11,6 @@ import (
"git.sr.ht/~rjarry/aerc/lib"
"git.sr.ht/~rjarry/aerc/lib/ui"
"git.sr.ht/~rjarry/aerc/log"
- "git.sr.ht/~rjarry/aerc/models"
"git.sr.ht/~rjarry/aerc/widgets"
"github.com/emersion/go-message/mail"
)
@@ -155,7 +154,7 @@ func unsubscribeMailto(aerc *widgets.Aerc, u *url.URL) error {
acct.Worker(),
"",
h,
- models.OriginalMail{},
+ nil,
)
if err != nil {
return err