Bug 1287753 - In-Reply-To: and References: should be removed from mail saved as Template (port bug 726281 to SeaMonkey). r=Ratty, a=Ratty RELEASE_48_END
authorrsx11m <rsx11m.pub@gmail.com>
Tue, 19 Jul 2016 20:27:03 -0500
changeset 27270 64ee8c5d419411787e86ffff60ae910da26568d2
parent 27269 2062c13508a36a5c59d7b4b42a80d2772f654fa3
child 27271 2d369610a690ed5ea2e6e9edaa50b1a70484cfa6
push id1850
push userclokep@gmail.com
push dateWed, 08 Mar 2017 19:29:12 +0000
treeherdercomm-esr52@028df196b2d9 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersRatty, Ratty
bugs1287753, 726281
Bug 1287753 - In-Reply-To: and References: should be removed from mail saved as Template (port bug 726281 to SeaMonkey). r=Ratty, a=Ratty
suite/mailnews/compose/MsgComposeCommands.js
--- a/suite/mailnews/compose/MsgComposeCommands.js
+++ b/suite/mailnews/compose/MsgComposeCommands.js
@@ -1583,19 +1583,33 @@ function SaveAsDraft()
   defaultSaveOperation = "draft";
 
   gAutoSaveKickedIn = false;
   gEditingDraft = true;
 }
 
 function SaveAsTemplate()
 {
+  let savedReferences = null;
+  if (gMsgCompose && gMsgCompose.compFields) {
+    // Clear References header. When we use the template, we don't want that
+    // header, yet, "edit as new message" maintains it. So we need to clear
+    // it when saving the template.
+    // Note: The In-Reply-To header is the last entry in the references header,
+    // so it will get cleared as well.
+    savedReferences = gMsgCompose.compFields.references;
+    gMsgCompose.compFields.references = null;
+  }
+
   GenericSendMessage(nsIMsgCompDeliverMode.SaveAsTemplate);
   defaultSaveOperation = "template";
 
+  if (savedReferences)
+    gMsgCompose.compFields.references = savedReferences;
+
   gAutoSaveKickedIn = false;
   gEditingDraft = false;
 }
 
 // Sets the additional FCC, in addition to the default FCC.
 function MessageFcc(menuItem)
 {
   if (!gMsgCompose)