MDL-60579 user: Don't lose text filters
authorDamyon Wiese <damyon@moodle.com>
Thu, 9 Nov 2017 03:04:32 +0000 (11:04 +0800)
committerDamyon Wiese <damyon@moodle.com>
Thu, 9 Nov 2017 03:06:30 +0000 (11:06 +0800)
When replacing a group filter with a different group filter - don't forget all the current text filters that have
been applied.

user/amd/build/unified_filter.min.js
user/amd/src/unified_filter.js

index ddca41b..a6d977b 100644 (file)
Binary files a/user/amd/build/unified_filter.min.js and b/user/amd/build/unified_filter.min.js differ
index e6d6e2a..a18d2fd 100644 (file)
@@ -70,12 +70,14 @@ define(['jquery', 'core/form-autocomplete', 'core/str', 'core/notification'],
         $(SELECTORS.UNIFIED_FILTERS).on('change', function() {
             var current = $(this).val();
             var listoffilters = [];
+            var textfilters = [];
             var updatedselectedfilters = false;
 
             $.each(current, function(index, catoption) {
                 var catandoption = catoption.split(':', 2);
                 if (catandoption.length !== 2) {
-                    return true; // Skip.
+                    textfilters.push(catoption);
+                    return true; // Text search filter.
                 }
 
                 var category = catandoption[0];
@@ -101,6 +103,7 @@ define(['jquery', 'core/form-autocomplete', 'core/str', 'core/notification'],
                 for (var category in listoffilters) {
                     updatefilters.push(category + ":" + listoffilters[category]);
                 }
+                updatefilters = updatefilters.concat(textfilters);
                 $(this).val(updatefilters);
             }