Bug 1271108 - Use sender/recipient or correspondent depending on preference. r=aceman a=rkent THUNDERBIRD452b1_2016051723_RELBRANCH
authorJorg K
Tue, 10 May 2016 08:39:13 +0200
branchTHUNDERBIRD452b1_2016051723_RELBRANCH
changeset 24617 6aebfedc330d1947e31b827fb7e77fdb9331cce3
parent 24616 742502786eb96c18c2c9d41458e35bc6c7af5255
child 24618 f26e2e10ac61ed06c80a884262b9b8feae662e61
push id1641
push userkent@caspia.com
push dateWed, 18 May 2016 07:34:32 +0000
treeherdercomm-beta@3d73a3597a7e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersaceman, rkent
bugs1271108
Bug 1271108 - Use sender/recipient or correspondent depending on preference. r=aceman a=rkent
mail/test/mozmill/folder-display/test-columns.js
mailnews/db/gloda/modules/dbview.js
--- a/mail/test/mozmill/folder-display/test-columns.js
+++ b/mail/test/mozmill/folder-display/test-columns.js
@@ -10,37 +10,87 @@ Cu.import("resource:///modules/MailUtils
 
 
 /*
  * Test column default logic and persistence logic.  Persistence comes in both
  *  tab-switching (because of the multiplexed implementation) and
  *  folder-switching forms.
  */
 
+// make SOLO_TEST=folder-display/test-columns.js mozmill-one
+
 var MODULE_NAME = 'test-columns';
 
 var RELATIVE_ROOT = '../shared-modules';
 var MODULE_REQUIRES = ['folder-display-helpers', 'window-helpers'];
 
 var folderInbox, folderSent, folderVirtual, folderA, folderB;
 // INBOX_DEFAULTS sans 'dateCol' but gains 'tagsCol'
 var columnsB;
 // GLODA_DEFAULTS sans 'locationCol' but gains 'accountCol'
 var glodaColumns;
 
 // these are for the reset/apply to other/apply to other+child tests.
 var folderSource, folderParent, folderChild1, folderChild2;
 
 var gColumnStateUpdated = false;
 
+var useCorrespondent;
+var INBOX_DEFAULTS;
+var SENT_DEFAULTS;
+var VIRTUAL_DEFAULTS;
+var GLODA_DEFAULTS;
+
 function setupModule(module) {
   let fdh = collector.getModule('folder-display-helpers');
   fdh.installInto(module);
   let wh = collector.getModule('window-helpers');
   wh.installInto(module);
+
+  useCorrespondent =
+    Services.prefs.getBoolPref("mail.threadpane.use_correspondents");
+  INBOX_DEFAULTS = [
+    "threadCol",
+    "flaggedCol",
+    "attachmentCol",
+    "subjectCol",
+    "unreadButtonColHeader",
+    useCorrespondent ? "correspondentCol" : "senderCol",
+    "junkStatusCol",
+    "dateCol"
+  ];
+  SENT_DEFAULTS = [
+    "threadCol",
+    "flaggedCol",
+    "attachmentCol",
+    "subjectCol",
+    "unreadButtonColHeader",
+    useCorrespondent ? "correspondentCol" : "recipientCol",
+    "junkStatusCol",
+    "dateCol"
+  ];
+  VIRTUAL_DEFAULTS = [
+    "threadCol",
+    "flaggedCol",
+    "attachmentCol",
+    "subjectCol",
+    "unreadButtonColHeader",
+    useCorrespondent ? "correspondentCol" : "senderCol",
+    "junkStatusCol",
+    "dateCol",
+    "locationCol"
+  ];
+  GLODA_DEFAULTS = [
+    "threadCol",
+    "flaggedCol",
+    "subjectCol",
+    useCorrespondent ? "correspondentCol" : "senderCol",
+    "dateCol",
+    "locationCol"
+  ];
 }
 
 /**
  * Verify that the provided list of columns is visible in the given order,
  *  throwing an exception if it is not the case.
  *
  * @param aDesiredColumns A list of column ID strings for columns that should be
  *     visible in the order that they should be visisble.
@@ -95,71 +145,37 @@ function hide_column(aColumnId) {
  *     before.
  */
 function reorder_column(aColumnId, aBeforeId) {
   let col = mc.e(aColumnId);
   let before = mc.e(aBeforeId);
   mc.threadTree._reorderColumn(col, before, true);
 }
 
-var INBOX_DEFAULTS = [
-  "threadCol",
-  "flaggedCol",
-  "attachmentCol",
-  "subjectCol",
-  "unreadButtonColHeader",
-  "correspondentCol",
-  "junkStatusCol",
-  "dateCol"
-];
-
 /**
  * Make sure we set the proper defaults for an Inbox.
  */
 function test_column_defaults_inbox() {
   // just use the inbox; comes from test-folder-display-helpers
   folderInbox = inboxFolder;
   enter_folder(folderInbox);
   assert_visible_columns(INBOX_DEFAULTS);
 }
 
-var SENT_DEFAULTS = [
-  "threadCol",
-  "flaggedCol",
-  "attachmentCol",
-  "subjectCol",
-  "unreadButtonColHeader",
-  "correspondentCol",
-  "junkStatusCol",
-  "dateCol"
-];
-
 /**
  * Make sure we set the proper defaults for a Sent folder.
  */
 function test_column_defaults_sent() {
   folderSent = create_folder("ColumnsSent");
   folderSent.setFlag(Ci.nsMsgFolderFlags.SentMail);
 
   be_in_folder(folderSent);
   assert_visible_columns(SENT_DEFAULTS);
 }
 
-var VIRTUAL_DEFAULTS = [
-  "threadCol",
-  "flaggedCol",
-  "attachmentCol",
-  "subjectCol",
-  "unreadButtonColHeader",
-  "correspondentCol",
-  "junkStatusCol",
-  "dateCol",
-  "locationCol"
-];
-
 /**
  * Make sure we set the proper defaults for a multi-folder virtual folder.
  */
 function test_column_defaults_cross_folder_virtual_folder() {
   folderVirtual = create_virtual_folder([folderInbox, folderSent], {},
                                         true, "ColumnsVirtual");
 
   be_in_folder(folderVirtual);
@@ -301,21 +317,21 @@ function test_column_visibility_persists
 
 /**
  * Test that reordering persists through tab changes and folder changes.
  */
 function test_column_reordering_persists() {
   let tabA = be_in_folder(folderA);
   let tabB = open_folder_in_new_tab(folderB);
 
-  // put correspondent before subject
-  reorder_column("correspondentCol", "subjectCol");
+  // put correspondent/sender before subject
+  reorder_column(useCorrespondent ? "correspondentCol" : "senderCol", "subjectCol");
   let reorderdB = columnsB.concat();
   reorderdB.splice(5, 1);
-  reorderdB.splice(3, 0, "correspondentCol");
+  reorderdB.splice(3, 0, useCorrespondent ? "correspondentCol" : "senderCol");
   assert_visible_columns(reorderdB);
 
   switch_tab(tabA);
   assert_visible_columns(INBOX_DEFAULTS);
 
   switch_tab(tabB);
   assert_visible_columns(reorderdB);
 
@@ -446,25 +462,16 @@ function test_apply_to_folder_and_childr
   assert_visible_columns(conExtra);
   be_in_folder(folderChild1);
   assert_visible_columns(conExtra);
   be_in_folder(folderChild2);
   assert_visible_columns(conExtra);
 }
 test_apply_to_folder_and_children.EXCLUDED_PLATFORMS = ["linux"];
 
-var GLODA_DEFAULTS = [
-  "threadCol",
-  "flaggedCol",
-  "subjectCol",
-  "correspondentCol",
-  "dateCol",
-  "locationCol"
-];
-
 /**
  * Create a fake gloda collection.
  */
 function FakeCollection() {
   this.items = [];
 }
 
 function plan_for_columns_state_update() {
--- a/mailnews/db/gloda/modules/dbview.js
+++ b/mailnews/db/gloda/modules/dbview.js
@@ -118,17 +118,20 @@ GlodaSyntheticView.prototype = {
     },
     flaggedCol: {
       visible: true,
     },
     subjectCol: {
       visible: true,
     },
     correspondentCol: {
-      visible: true,
+      visible: Services.prefs.getBoolPref("mail.threadpane.use_correspondents"),
+    },
+    senderCol: {
+      visible: !Services.prefs.getBoolPref("mail.threadpane.use_correspondents"),
     },
     dateCol: {
       visible: true,
     },
     locationCol: {
       visible: true,
     },
   },