aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJason Cox <me@jasoncarloscox.com>2024-02-23 11:40:16 -0500
committerRobin Jarry <robin@jarry.cc>2024-04-02 22:22:25 +0200
commit54a72f83035bdf710368846e55a5b003ccab66cd (patch)
treebdf5f745da4918d05a1493df6382213853780f3c
parent3ee53c3012ea2a01bfce19c087c6ed0c8251a797 (diff)
downloadaerc-54a72f83035bdf710368846e55a5b003ccab66cd.tar.gz
notmuch: simplify moving a message
Delete the existing file from the database after indexing the new one to avoid the need to remember and re-apply tags. Signed-off-by: Jason Cox <me@jasoncarloscox.com> Tested-by: Maarten Aertsen <maarten@nlnetlabs.nl> Acked-by: Robin Jarry <robin@jarry.cc>
-rw-r--r--worker/notmuch/message.go11
1 files changed, 1 insertions, 10 deletions
diff --git a/worker/notmuch/message.go b/worker/notmuch/message.go
index 2a8b1730..09850d64 100644
--- a/worker/notmuch/message.go
+++ b/worker/notmuch/message.go
@@ -237,19 +237,10 @@ func (m *Message) Move(srcDir, destDir maildir.Dir) error {
return fmt.Errorf("no matching message file found in %s", string(srcDir))
}
- tags, err := m.Tags()
- if err != nil {
- return err
- }
-
// Remove encoded UID information from the key to prevent sync issues
name := lib.StripUIDFromMessageFilename(filepath.Base(src))
dest := filepath.Join(string(destDir), "cur", name)
- if err := m.db.DeleteMessage(src); err != nil {
- return err
- }
-
if err := os.Rename(src, dest); err != nil {
return err
}
@@ -258,7 +249,7 @@ func (m *Message) Move(srcDir, destDir maildir.Dir) error {
return err
}
- if err := m.ModifyTags(tags, nil); err != nil {
+ if err := m.db.DeleteMessage(src); err != nil {
return err
}