Skip to content

fix(mail): expunge source folder after IMAP move/spam/ham - #66

Open
ThomasMms23 wants to merge 1 commit into
developfrom
fix/mail-move-expunge
Open

ThomasMms23 wants to merge 1 commit into
developfrom
fix/mail-move-expunge

Conversation

@ThomasMms23

Copy link
Copy Markdown
Member

Summary

  • IMAP move / spam / ham did COPY + \Deleted but never EXPUNGE.
  • Without EXPUNGE the original stays in the source folder, so a later move copies it again (duplicates).
  • After flagging \Deleted, expunge the source folder (do_children=False), same pattern as delete_mails_by_uid.
  • copy is unchanged.

Why

Spotted while drag-and-dropping mails in SOGo6-UI (batch-action move). Same bug on any move, not only DnD.

Note for review

Folder EXPUNGE removes every \Deleted message in that folder, not only the moved UIDs. That already matches delete. UID EXPUNGE would be narrower if we want it later.

Test plan

  • Move a mail Inbox → custom folder: it leaves Inbox and appears only in the destination
  • Move it back: no duplicate in either folder
  • Copy a mail: original stays in the source folder
  • Unit tests: tests/test_module/test_mail/test_moduleMail.py (move/spam/ham expunge, copy does not)

@ThomasMms23
ThomasMms23 requested a review from QHivert September 1, 2026 12:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant