diff options
author | Robin Jarry <robin@jarry.cc> | 2023-03-07 00:02:47 +0100 |
---|---|---|
committer | Robin Jarry <robin@jarry.cc> | 2023-03-08 00:42:58 +0100 |
commit | 66c532f859dd477ce57e222107c6b371e66064b8 (patch) | |
tree | 215d74f96cc1442cef496663dd266af5adf5926c /lib/state | |
parent | 35040bec9962cac3c92039fac85a4068e148b0a0 (diff) | |
download | aerc-66c532f859dd477ce57e222107c6b371e66064b8.tar.gz |
templates: make SubjectBase official api
Document .SubjectBase. Fix its value along the way. Do not reuse
d.Subject() which may be empty if d.threadSameSubject is true.
Signed-off-by: Robin Jarry <robin@jarry.cc>
Acked-by: Tim Culverhouse <tim@timculverhouse.com>
Diffstat (limited to 'lib/state')
-rw-r--r-- | lib/state/templates.go | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/lib/state/templates.go b/lib/state/templates.go index 2e351a7a..b5a5ee05 100644 --- a/lib/state/templates.go +++ b/lib/state/templates.go @@ -244,7 +244,14 @@ func (d *TemplateData) Subject() string { } func (d *TemplateData) SubjectBase() string { - base, _ := sortthread.GetBaseSubject(d.Subject()) + var subject string + switch { + case d.info != nil && d.info.Envelope != nil: + subject = d.info.Envelope.Subject + case d.headers != nil: + subject = d.Header("subject") + } + base, _ := sortthread.GetBaseSubject(subject) return base } |