From 66c532f859dd477ce57e222107c6b371e66064b8 Mon Sep 17 00:00:00 2001 From: Robin Jarry Date: Tue, 7 Mar 2023 00:02:47 +0100 Subject: 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 Acked-by: Tim Culverhouse --- lib/state/templates.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'lib/state') 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 } -- cgit