+ // Add highlight
+ newData.params.highlight = String( Number( highlightEnabled || 0 ) );
+
+ return newData;
+ };
+
+ /**
+ * Get an object representing the base state of parameters
+ * and highlights.
+ *
+ * This is meant to make sure that the saved queries that are
+ * in memory are always the same structure as what we would get
+ * by calling the current model's "getSelectedState" and by checking
+ * highlight items.
+ *
+ * In cases where a user saved a query when the system had a certain
+ * set of params, and then a filter was added to the system, we want
+ * to make sure that the stored queries can still be comparable to
+ * the current state, which means that we need the base state for
+ * two operations:
+ *
+ * - Saved queries are stored in "minimal" view (only changed params
+ * are stored); When we initialize the system, we merge each minimal
+ * query with the base state (using 'getMinimalParamList') so all
+ * saved queries have the exact same structure as what we would get
+ * by checking the getSelectedState of the filter.
+ * - When we save the queries, we minimize the object to only represent
+ * whatever has actually changed, rather than store the entire
+ * object. To check what actually is different so we can store it,
+ * we need to obtain a base state to compare against, this is
+ * what #getMinimalParamList does
+ *
+ * @return {Object} Base parameter state
+ */
+ mw.rcfilters.dm.SavedQueriesModel.prototype.getBaseParamState = function () {
+ var allParams,
+ highlightedItems = {};
+
+ if ( !this.baseParamState ) {
+ allParams = this.filtersModel.getParametersFromFilters( {} );
+
+ // Prepare highlights
+ this.filtersModel.getItemsSupportingHighlights().forEach( function ( item ) {
+ highlightedItems[ item.getName() + '_color' ] = null;
+ } );
+
+ this.baseParamState = {
+ params: $.extend( true, { highlight: '0' }, allParams ),
+ highlights: highlightedItems
+ };