diff --git a/mail/base/content/mailCommands.js b/mail/base/content/mailCommands.js index 3c6c21df4f1..b039bf360eb 100644 --- a/mail/base/content/mailCommands.js +++ b/mail/base/content/mailCommands.js @@ -744,10 +744,17 @@ function filterFolderForJunk() function JunkSelectedMessages(setAsJunk) { MsgJunkMailInfo(true); - gDBView.doCommand(setAsJunk ? nsMsgViewCommandType.junk : nsMsgViewCommandType.unjunk); - // XXX TODO - // consider whether these messages should be - // marked as read (if markAsReadOnSpam is set) + + // When the user explicitly marks a message as junk, he doesn't want it to + // stay unread (even if he does want that for automatically-classified ones), + // so we always mark as read here (pref-independent, see bug 220933). + // Note that this behaviour should match the one in the back end for marking + // as junk via clicking the 'junk' column. + if (setAsJunk) + MarkSelectedMessagesRead(true); + + gDBView.doCommand(setAsJunk ? nsMsgViewCommandType.junk + : nsMsgViewCommandType.unjunk); } function deleteJunkInFolder() diff --git a/mailnews/base/resources/content/mailCommands.js b/mailnews/base/resources/content/mailCommands.js index 39876b0baa2..cf22b519b0d 100644 --- a/mailnews/base/resources/content/mailCommands.js +++ b/mailnews/base/resources/content/mailCommands.js @@ -686,17 +686,17 @@ function filterFolderForJunk() function JunkSelectedMessages(setAsJunk) { - MsgJunkMailInfo(true); - + MsgJunkMailInfo(true); + // When the user explicitly marks a message as junk, he doesn't want it to // stay unread (even if he does want that for automatically-classified ones), // so we always mark as read here (pref-independent, see bug 220933). // Note that this behaviour should match the one in the back end for marking // as junk via clicking the 'junk' column. if (setAsJunk) - MarkSelectedMessagesRead(true); - - gDBView.doCommand(setAsJunk ? nsMsgViewCommandType.junk + MarkSelectedMessagesRead(true); + + gDBView.doCommand(setAsJunk ? nsMsgViewCommandType.junk : nsMsgViewCommandType.unjunk); }