Bug 1639452 - Change ReplyIgnoreQuote to be a boolean parameter. r=mkmelin draft
authorPing Chen <remotenonsense@gmail.com>
Tue, 02 Jun 2020 08:57:01 +0900
changeset 88579 24fdfaf33ae98032c265c066142b8bc501655455
parent 88578 fa07bf30c747b6a6cf61909fc123fc4e9ce8ff77
child 88580 99b035d0305309bb1497aac010a554aa8443fb20
push id11143
push userremotenonsense@gmail.com
push dateTue, 02 Jun 2020 05:36:16 +0000
treeherdertry-comm-central@24fdfaf33ae9 [default view] [failures only]
reviewersmkmelin
bugs1639452
Bug 1639452 - Change ReplyIgnoreQuote to be a boolean parameter. r=mkmelin
calendar/lightning/content/lightning-item-panel.js
mail/base/content/macMessengerMenu.js
mail/base/content/mailCommands.js
mail/components/compose/content/MsgComposeCommands.js
mail/components/extensions/parent/ext-compose.js
mail/components/newmailaccount/content/accountProvisioner.js
mailnews/compose/public/nsIMsgComposeParams.idl
mailnews/compose/public/nsIMsgComposeService.idl
mailnews/compose/src/nsMsgComposeService.cpp
mailnews/extensions/newsblog/content/newsblogOverlay.js
--- a/calendar/lightning/content/lightning-item-panel.js
+++ b/calendar/lightning/content/lightning-item-panel.js
@@ -471,17 +471,18 @@ function openNewMessage() {
   MailServices.compose.OpenComposeWindow(
     null,
     null,
     null,
     Ci.nsIMsgCompType.New,
     Ci.nsIMsgCompFormat.Default,
     null,
     null,
-    null
+    null,
+    true
   );
 }
 
 /**
  * Open a new addressbook window
  */
 function openNewCardDialog() {
   window.openDialog(
--- a/mail/base/content/macMessengerMenu.js
+++ b/mail/base/content/macMessengerMenu.js
@@ -83,17 +83,18 @@ function writeNewMessageDock() {
   MailServices.compose.OpenComposeWindow(
     null,
     null,
     null,
     Ci.nsIMsgCompType.New,
     Ci.nsIMsgCompFormat.Default,
     null,
     null,
-    null
+    null,
+    true
   );
 }
 
 /**
  * Open the address book window
  */
 function openAddressBookDock() {
   let win = Services.wm.getMostRecentWindow("mail:addressbook");
--- a/mail/base/content/mailCommands.js
+++ b/mail/base/content/mailCommands.js
@@ -175,30 +175,32 @@ function ComposeMessage(type, format, fo
       MailServices.compose.OpenComposeWindow(
         null,
         null,
         null,
         type,
         format,
         identity,
         null,
-        msgWindow
+        msgWindow,
+        ignoreQuote
       );
       return;
     case msgComposeType.NewsPost:
       // dump("OpenComposeWindow with " + identity + " and " + newsgroup + "\n");
       MailServices.compose.OpenComposeWindow(
         null,
         null,
         newsgroup,
         type,
         format,
         identity,
         null,
-        msgWindow
+        msgWindow,
+        ignoreQuote
       );
       return;
     case msgComposeType.ForwardAsAttachment:
       if (messageArray && messageArray.length) {
         // If we have more than one ForwardAsAttachment then pass null instead
         // of the header to tell the compose service to work out the attachment
         // subjects from the URIs.
         hdr =
@@ -208,17 +210,18 @@ function ComposeMessage(type, format, fo
         MailServices.compose.OpenComposeWindow(
           null,
           hdr,
           messageArray.join(","),
           type,
           format,
           identity,
           null,
-          msgWindow
+          msgWindow,
+          ignoreQuote
         );
       }
       return;
     default:
       if (!messageArray) {
         return;
       }
 
@@ -236,25 +239,22 @@ function ComposeMessage(type, format, fo
           // possible server identity from above.
           openComposeWindowForRSSArticle(
             null,
             hdr,
             messageUri,
             type,
             format,
             identity,
-            msgWindow
+            msgWindow,
+            true
           );
         } else {
           // Replies come here.
 
-          if (ignoreQuote) {
-            type += msgComposeType.ReplyIgnoreQuote;
-          }
-
           let useCatchAll = false;
           // Check if we are using catchAll on any identity. If current
           // folder has some customIdentity set, ignore catchAll settings.
           if (!(hdr.folder && hdr.folder.customIdentity)) {
             useCatchAll = MailServices.accounts.allIdentities.some(
               identity => identity.catchAll
             );
           }
@@ -325,17 +325,18 @@ function ComposeMessage(type, format, fo
                 MailServices.compose.OpenComposeWindow(
                   null,
                   hdr,
                   messageUri,
                   type,
                   format,
                   identity,
                   matchingHint.toString(),
-                  msgWindow
+                  msgWindow,
+                  ignoreQuote
                 );
               },
               true,
               { saneBodySize: true, partsOnDemand: true }
             );
           } else {
             // Fall back to traditional behavior.
             let [hdrIdentity] = MailUtils.getIdentityForHeader(
@@ -346,17 +347,18 @@ function ComposeMessage(type, format, fo
             MailServices.compose.OpenComposeWindow(
               null,
               hdr,
               messageUri,
               type,
               format,
               hdrIdentity,
               null,
-              msgWindow
+              msgWindow,
+              ignoreQuote
             );
           }
         }
       }
   }
 }
 /* eslint-enable complexity */
 
--- a/mail/components/compose/content/MsgComposeCommands.js
+++ b/mail/components/compose/content/MsgComposeCommands.js
@@ -1476,17 +1476,18 @@ function goOpenNewMessage(aEvent) {
   MailServices.compose.OpenComposeWindow(
     null,
     null,
     null,
     Ci.nsIMsgCompType.New,
     msgCompFormat,
     identity,
     null,
-    null
+    null,
+    true
   );
 }
 
 function QuoteSelectedMessage() {
   var selectedURIs = GetSelectedMessages();
   if (selectedURIs) {
     for (let i = 0; i < selectedURIs.length; i++) {
       gMsgCompose.quoteMessage(selectedURIs[i]);
--- a/mail/components/extensions/parent/ext-compose.js
+++ b/mail/components/extensions/parent/ext-compose.js
@@ -79,17 +79,18 @@ async function openComposeWindow(related
     MailServices.compose.OpenComposeWindow(
       null,
       msgHdr,
       msgURI,
       type,
       0,
       hdrIdentity,
       null,
-      null
+      null,
+      true
     );
     return newWindowPromise;
   }
 
   let params = Cc[
     "@mozilla.org/messengercompose/composeparams;1"
   ].createInstance(Ci.nsIMsgComposeParams);
   let composeFields = Cc[
--- a/mail/components/newmailaccount/content/accountProvisioner.js
+++ b/mail/components/newmailaccount/content/accountProvisioner.js
@@ -191,17 +191,18 @@ var EmailAccountProvisioner = {
         MailServices.compose.OpenComposeWindow(
           null,
           null,
           null,
           Ci.nsIMsgCompType.New,
           Ci.nsIMsgCompFormat.Default,
           account.defaultIdentity,
           null,
-          null
+          null,
+          true
         );
       });
 
     document
       .getElementById("success-addons")
       .addEventListener("click", function() {
         EmailAccountProvisioner.openAddonsMgr();
       });
--- a/mailnews/compose/public/nsIMsgComposeParams.idl
+++ b/mailnews/compose/public/nsIMsgComposeParams.idl
@@ -44,22 +44,16 @@ interface nsIMsgCompType : nsISupports {
      * are sanitized since the message could be from external sources.
      */
     const long EditAsNew                = 15;
 
     /**
      * Used to edit an existing template.
      */
     const long EditTemplate             = 16;
-
-    /**
-     * Add this value to a reply type to suppress quoting the current selection
-     * which may not belong to the message being replied to.
-     */
-    const long ReplyIgnoreQuote         = 100;
 };
 
 
 typedef long MSG_ComposeFormat;
 
 [scriptable, uuid(a28325e8-7531-11d3-8f1c-006008948010)]
 interface nsIMsgCompFormat : nsISupports{
     const long Default                  = 0;
--- a/mailnews/compose/public/nsIMsgComposeService.idl
+++ b/mailnews/compose/public/nsIMsgComposeService.idl
@@ -22,17 +22,18 @@ interface nsIMsgComposeService : nsISupp
   [can_run_script]
   void OpenComposeWindow(in string msgComposeWindowURL,
                          in nsIMsgDBHdr msgHdr,
                          in string originalMsgURI,
                          in MSG_ComposeType type,
                          in MSG_ComposeFormat format,
                          in nsIMsgIdentity identity,
                          in AUTF8String from,
-                         in nsIMsgWindow aMsgWindow);
+                         in nsIMsgWindow aMsgWindow,
+                         in boolean ignoreQuote);
 
   /**
    * Open a compose window given a mailto url and (optionally) an identity.
    *
    * @param aMsgComposeWindowURL Can be null in most cases. If you have your
    *                             own chrome url you want to use in bringing up a
    *                             compose window, pass it in here.
    * @param aURI                 The mailto url you want to use as the
--- a/mailnews/compose/src/nsMsgComposeService.cpp
+++ b/mailnews/compose/src/nsMsgComposeService.cpp
@@ -345,26 +345,20 @@ nsMsgComposeService::GetOrigWindowSelect
 
   return rv;
 }
 
 MOZ_CAN_RUN_SCRIPT_FOR_DEFINITION NS_IMETHODIMP
 nsMsgComposeService::OpenComposeWindow(
     const char *msgComposeWindowURL, nsIMsgDBHdr *origMsgHdr,
     const char *originalMsgURI, MSG_ComposeType type, MSG_ComposeFormat format,
-    nsIMsgIdentity *aIdentity, const nsACString &from, nsIMsgWindow *aMsgWindow) {
+    nsIMsgIdentity *aIdentity, const nsACString &from, nsIMsgWindow *aMsgWindow,
+    bool ignoreQuote) {
   nsresult rv;
 
-  // Check for any reply type that wants to ignore the quote.
-  bool ignoreQuote = false;
-  if (type >= nsIMsgCompType::ReplyIgnoreQuote) {
-    type -= nsIMsgCompType::ReplyIgnoreQuote;
-    ignoreQuote = true;
-  }
-
   nsCOMPtr<nsIMsgIdentity> identity = aIdentity;
   if (!identity) GetDefaultIdentity(getter_AddRefs(identity));
 
   /* Actually, the only way to implement forward inline is to simulate a
      template message. Maybe one day when we will have more time we can change
      that
   */
   if (type == nsIMsgCompType::ForwardInline || type == nsIMsgCompType::Draft ||
--- a/mailnews/extensions/newsblog/content/newsblogOverlay.js
+++ b/mailnews/extensions/newsblog/content/newsblogOverlay.js
@@ -317,17 +317,18 @@ function openSubscriptionsDialog(aFolder
 // the current feed message is being viewed as either a summary or web page.
 function openComposeWindowForRSSArticle(
   aMsgComposeWindow,
   aMsgHdr,
   aMessageUri,
   aType,
   aFormat,
   aIdentity,
-  aMsgWindow
+  aMsgWindow,
+  ignoreQuote = true
 ) {
   // Ensure right content is handled for web pages in window/tab.
   let tabmail = document.getElementById("tabmail");
   let is3pane =
     tabmail && tabmail.selectedTab && tabmail.selectedTab.mode
       ? tabmail.selectedTab.mode.type == "folder"
       : false;
   let showingwebpage =
@@ -340,17 +341,18 @@ function openComposeWindowForRSSArticle(
     MailServices.compose.OpenComposeWindow(
       aMsgComposeWindow,
       aMsgHdr,
       aMessageUri,
       aType,
       aFormat,
       aIdentity,
       null,
-      aMsgWindow
+      aMsgWindow,
+      ignoreQuote
     );
   } else {
     // Set up the compose message and get the feed message's web page link.
     let msgHdr = aMsgHdr;
     let type = aType;
     let msgComposeType = Ci.nsIMsgCompType;
     let subject = msgHdr.mime2DecodedSubject;
     let fwdPrefix = Services.prefs.getCharPref("mail.forward_subject_prefix");
@@ -408,30 +410,32 @@ function openComposeWindowForRSSArticle(
             MailServices.compose.OpenComposeWindow(
               aMsgComposeWindow,
               aMsgHdr,
               aMessageUri,
               aType,
               aFormat,
               aIdentity,
               null,
-              aMsgWindow
+              aMsgWindow,
+              ignoreQuote
             );
           }
         },
         false,
         { saneBodySize: true }
       );
     } catch (ex) {
       // Error getting header, use the summary.
       MailServices.compose.OpenComposeWindow(
         aMsgComposeWindow,
         aMsgHdr,
         aMessageUri,
         aType,
         aFormat,
         aIdentity,
         null,
-        aMsgWindow
+        aMsgWindow,
+        ignoreQuote
       );
     }
   }
 }