- Shipped
- August 7, 2026 at 1:57 AM UTC
- Author
- Kamo
- Commit
- ab17568
Mark all read and Empty folder are folder-wide operations the client cannot express by batching uids: it only ever holds the page it has scrolled, so a folder with 4,000 unread would take 80 round trips and still miss everything it never loaded. FolderManager gains setFolderSeen and emptyFolder. The IMAP path flips flags in one server-side call and only touches messages that actually disagree with the target state — a blanket setFlags rewrites flags the server already has and makes every connected client resync for nothing. Graph has no bulk equivalent, so it walks the folder and PATCHes; the filter shrinks as it goes, so it re-reads the first page instead of paging with $skip, which would step over items the previous batch just flipped out of the result set. Its sweep ceiling is logged, never silent. Emptying keeps Trash special: Trash is expunged for real, every other folder moves its contents to Trash and stays recoverable. Graph's DELETE already behaves that way, so no folder-name special-casing there. Both endpoints return how many messages moved, so the UI can tell "marked 240 read" from "nothing to do", and only publish a change event when something actually changed.