Bug 649890 - The "M" shortcut for mark read/mark unread is nonfunctional in the standalone message window; r=bwinton
authorJim Porter <squibblyflabbetydoo@gmail.com>
Tue, 26 Apr 2011 01:52:48 -0500
changeset 7612 d938fa0debf7b083be0edf5a3a7285ec7ea9259b
parent 7611 210f183920f2d323f593b0bff0bff9b2840cfe6e
child 7613 14758a3132354c9cc8b98a4f8a4754f770b33297
push idunknown
push userunknown
push dateunknown
reviewersbwinton
bugs649890
Bug 649890 - The "M" shortcut for mark read/mark unread is nonfunctional in the standalone message window; r=bwinton
mail/base/content/messageWindow.js
mail/test/mozmill/folder-display/test-message-window.js
--- a/mail/base/content/messageWindow.js
+++ b/mail/base/content/messageWindow.js
@@ -710,16 +710,17 @@ var MessageWindowController =
       case "cmd_killThread":
       case "cmd_killSubthread":
       case "cmd_watchThread":
       case "button_delete":
       case "button_junk":
       case "cmd_shiftDelete":
       case "cmd_tag":
       case "button_mark":
+      case "cmd_toggleRead":
       case "cmd_markAsRead":
       case "cmd_markAsUnread":
       case "cmd_markAllRead":
       case "cmd_markThreadAsRead":
       case "cmd_markReadByDate":
       case "cmd_markAsFlagged":
       case "cmd_markAsJunk":
       case "cmd_markAsNotJunk":
@@ -859,16 +860,17 @@ var MessageWindowController =
       case "cmd_tag":
       case "button_mark":
       case "cmd_markAllRead":
       case "cmd_markThreadAsRead":
       case "cmd_markReadByDate":
       case "cmd_viewAllHeader":
       case "cmd_viewNormalHeader":
       case "cmd_stop":
+      case "cmd_toggleRead":
         return true;
       case "cmd_markAsRead":
         return CanMarkMsgAsRead(true);
       case "cmd_markAsUnread":
         return CanMarkMsgAsRead(false);
       case "cmd_markAsFlagged":
       case "button_file":
         return ( gFolderDisplay.selectedMessage != null);
@@ -1051,16 +1053,19 @@ var MessageWindowController =
         document.getElementById("FindToolbar").onFindAgainCommand(true)
         break;
       case "cmd_search":
         MsgSearchMessages();
         break;
       case "button_mark":
         MsgMarkMsgAsRead();
         return;
+      case "cmd_toggleRead":
+        MsgMarkMsgAsRead();
+        return;
       case "cmd_markAsRead":
         MsgMarkMsgAsRead(true);
         return;
       case "cmd_markAsUnread":
         MsgMarkMsgAsRead(false);
         return;
       case "cmd_markThreadAsRead":
         ClearPendingReadTimer();
--- a/mail/test/mozmill/folder-display/test-message-window.js
+++ b/mail/test/mozmill/folder-display/test-message-window.js
@@ -41,16 +41,17 @@
  *  folder pane.
  */
 var MODULE_NAME = 'test-message-window';
 
 var RELATIVE_ROOT = '../shared-modules';
 var MODULE_REQUIRES = ['folder-display-helpers', 'window-helpers'];
 
 var folder;
+var curMessage;
 
 function setupModule(module) {
   let fdh = collector.getModule('folder-display-helpers');
   fdh.installInto(module);
   let wh = collector.getModule('window-helpers');
   wh.installInto(module);
 
   folder = create_folder("MessageWindowA");
@@ -65,24 +66,36 @@ function setupModule(module) {
 
 /** The message window controller. */
 var msgc;
 
 function test_open_message_window() {
   be_in_folder(folder);
 
   // select the first message
-  let curMessage = select_click_row(0);
+  curMessage = select_click_row(0);
 
   // display it
   msgc = open_selected_message_in_new_window();
   assert_selected_and_displayed(msgc, curMessage);
 }
 
 /**
+ * Use the "m" keyboard accelerator to mark a message as read or unread.
+ */
+function test_toggle_read() {
+  curMessage.markRead(false);
+  msgc.keypress(null, "m", {});
+  assert_true(curMessage.isRead, "Message should have been marked read!");
+
+  msgc.keypress(null, "m", {});
+  assert_true(!curMessage.isRead, "Message should have been marked unread!");
+}
+
+/**
  * Use the "f" keyboard accelerator to navigate to the next message,
  * and verify that it is indeed loaded.
  */
 function test_navigate_to_next_message() {
   plan_for_message_display(msgc);
   msgc.keypress(null, "f", {});
   wait_for_message_display_completion(msgc, true);
   assert_selected_and_displayed(msgc, 1);