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 34317 fac9afbc5ce3b5cf6738361f3591429e06b2c5cd
parent 34316 fb7f15d135af1492727d944176ea765ae7e6157b
child 34318 99bc32d53976fa2e087dbc40d7121cea3fbfc5fd
push id389
push userclokep@gmail.com
push dateMon, 18 Mar 2019 19:01:53 +0000
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