Bug 1523048 - when copying a filter, copy its triggering events too (filterType). r+a=jorgk
authoraceman <acelists@atlas.sk>
Sat, 02 Feb 2019 10:38:00 +0100
changeset 33463 fac9afbc5ce3
parent 33462 fb7f15d135af
child 33464 99bc32d53976
push id2371
push usermozilla@jorgk.com
push dateFri, 08 Feb 2019 10:35:50 +0000
treeherdercomm-beta@86cb9d0c8982 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1523048
Bug 1523048 - when copying a filter, copy its triggering events too (filterType). r+a=jorgk
mailnews/base/search/content/FilterEditor.js
--- a/mailnews/base/search/content/FilterEditor.js
+++ b/mailnews/base/search/content/FilterEditor.js
@@ -119,41 +119,43 @@ function filterEditorOnLoad()
             nsMsgSearchScope.newsFilter) ?
             nsMsgFilterAction.Delete : nsMsgFilterAction.MoveToFolder;
         gFilter.appendAction(filterAction);
         initializeDialog(gFilter);
       }
       else if ("copiedFilter" in args)
       {
         // we are copying a filter
-        var copiedFilter = args.copiedFilter;
-        var copiedName = gFilterBundle.getFormattedString("copyToNewFilterName",
+        let copiedFilter = args.copiedFilter;
+        let copiedName = gFilterBundle.getFormattedString("copyToNewFilterName",
           [copiedFilter.filterName]);
         let newFilter = gFilterList.createFilter(copiedName);
 
         // copy the actions
         for (let i = 0; i < copiedFilter.actionCount; i++)
         {
           let filterAction = copiedFilter.getActionAt(i);
           newFilter.appendAction(filterAction);
         }
 
         // copy the search terms
         for (let i = 0; i < copiedFilter.searchTerms.length; i++)
         {
           let searchTerm = copiedFilter.searchTerms.queryElementAt(i,
             Ci.nsIMsgSearchTerm);
 
-          var newTerm = newFilter.createTerm();
+          let newTerm = newFilter.createTerm();
           newTerm.attrib = searchTerm.attrib;
           newTerm.op = searchTerm.op;
           newTerm.booleanAnd = searchTerm.booleanAnd;
           newTerm.value = searchTerm.value;
           newFilter.appendTerm(newTerm);
-        };
+        }
+
+        newFilter.filterType = copiedFilter.filterType;
 
         gPreFillName = copiedName;
         gFilter = newFilter;
 
         initializeDialog(gFilter);
 
         // We reset the filter name, because otherwise the saveFilter()
         // function thinks we are editing a filter, and will thus skip the name