From 11b035f120969758d1b08dddd761f9375504de55 Mon Sep 17 00:00:00 2001 From: Jason Cox Date: Thu, 25 Jan 2024 08:25:51 -0500 Subject: flags: add support for draft flag Support the draft flag wherever flags are used. Automatically set it when postponing a message, and allow recalling a message without the -f flag if it has the draft flag set, regardless of what folder it's in. Notmuch doesn't seem to pick up on the draft flag when indexing even though the flag is set on the maildir file. Explicitly set all tags corresponding to set flags when appending a message in notmuch. Changelog-added: Support the `draft` flag. Signed-off-by: Jason Cox Acked-by: Robin Jarry --- lib/state/templates.go | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'lib/state') diff --git a/lib/state/templates.go b/lib/state/templates.go index ac701e9f..d039f1b6 100644 --- a/lib/state/templates.go +++ b/lib/state/templates.go @@ -393,6 +393,9 @@ func (d *templateData) Flags() []string { default: flags = append(flags, d.ui().IconOld) // message is unread and old } + if d.info.Flags.Has(models.DraftFlag) { + flags = append(flags, d.ui().IconDraft) + } if d.info.Flags.Has(models.DeletedFlag) { flags = append(flags, d.ui().IconDeleted) } @@ -452,6 +455,13 @@ func (d *templateData) IsFlagged() bool { return false } +func (d *templateData) IsDraft() bool { + if d.info != nil && d.info.Flags.Has(models.DraftFlag) { + return true + } + return false +} + func (d *templateData) IsMarked() bool { return d.marked } -- cgit