Repository navigation
fix(ui): show "Mark not spam" for unflagged junk messages - #14324
Merged
Merged
Conversation
Messages delivered to the Junk folder usually have no $junk keyword. The UI offered "Mark as spam" for them and only set $junk, so the message stayed in the folder and users had to click again to get "Mark not spam". Junk state is now derived in one store method, isEnvelopeJunk: $junk always counts, and an unflagged message in a junk folder (the account's junk mailbox or a folder with the junk special use) counts as junk unless it has $notjunk. The row and thread menus, the junk icons, the bulk selection, and the toggle and move actions use it. The "Mark as spam" quick action stays one-way: it skips messages that are already junk and never moves a message back to the inbox. The normal menu toggle still works in both directions. Not changed: the $Junk/$NotJunk keyword names (#13815), the order of the flag updates in setFlags, and the $notjunk flag on the copy that MoveJunkListener creates in INBOX. A message that keeps $notjunk inside the Junk folder still shows "Mark as spam". Fixes #11168 Assisted-by: ClaudeCode:claude-sonnet-5-5 Assisted-by: ClaudeCode:claude-opus-5-5 Assisted-by: ClaudeCode:claude-haiku-5-5 Signed-off-by: Christoph Wurst <1374172+ChristophWurst@users.noreply.github.com>
ChristophWurst
requested review from
DerDreschner,
GretaD and
kesselb
as code owners
November 26, 2026 10:06
Member
Author
|
/backport to stable5.13 Assisted by ClaudeCode:claude-sonnet-5-5 |
kesselb
approved these changes
Nov 26, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Context
Fixes #11168
Messages in the Junk folder usually have no
$junkkeyword. The UI offered "Mark as spam" for them, which only set the keyword and left the message in the folder, so users had to click again to get "Mark not spam".Approach
The junk state is now read in one place, the store method
isEnvelopeJunk. A message counts as junk if it has$junk, or if it is in a junk folder (the account's junk folder or a folder with the junk special use) and has no$notjunk. The row and thread menus, the junk icons, the bulk selection and the toggle and move actions all use it. Outside junk folders nothing changes.Visible effects:
Known limit: a message that keeps
$notjunkinside the Junk folder (for example anonjunkkeyword set by another client, or a message moved back by hand) still shows "Mark as spam".The
$Junkand$NotJunkkeyword names are unchanged, so #13815 would only need to touch this method.Screenshots
Testing
Unit tests cover the junk method, the move and toggle decisions (including the restore after a failed request), the quick action in both layouts, the menu and icon properties, and the bulk selection methods.
Checked by hand in a browser against a local IMAP account with a Junk folder: the row menu, icon and thread view, the bulk menu label, the quick action on a single message and on a thread, and "Mark not spam" moving a message to the inbox. Not tested: JMAP accounts, the dark theme, the mobile layout, and the spam and ham reports sent to the learning backend.
Assisted by ClaudeCode:claude-sonnet-5-5, ClaudeCode:claude-opus-5-5, ClaudeCode:claude-haiku-5-5