RCFilters: hygiene
authorStephane Bisson <sbisson@wikimedia.org>
Wed, 10 Apr 2019 21:28:33 +0000 (17:28 -0400)
committerStephane Bisson <sbisson@wikimedia.org>
Wed, 10 Apr 2019 23:28:46 +0000 (19:28 -0400)
Remove unused code, unneeded initialization
and fix documentation.

Change-Id: I82d7239b9003a82bc30484b01cf29e01c988b0d6

resources/src/mediawiki.rcfilters/Controller.js
resources/src/mediawiki.rcfilters/dm/FilterGroup.js
resources/src/mediawiki.rcfilters/dm/FilterItem.js
resources/src/mediawiki.rcfilters/dm/FiltersViewModel.js
resources/src/mediawiki.rcfilters/ui/ChangesLimitAndDateButtonWidget.js
resources/src/mediawiki.rcfilters/ui/ChangesListWrapperWidget.js
resources/src/mediawiki.rcfilters/ui/GroupWidget.js
resources/src/mediawiki.rcfilters/ui/SavedLinksListItemWidget.js

index b6284fb..97b73ae 100644 (file)
@@ -34,7 +34,6 @@ Controller = function MwRcfiltersController( filtersModel, changesListModel, sav
        this.pollingRate = require( './config.json' ).StructuredChangeFiltersLiveUpdatePollingRate;
 
        this.requestCounter = {};
-       this.baseFilterState = {};
        this.uriProcessor = null;
        this.initialized = false;
        this.wereSavedQueriesSaved = false;
index 8bd5eb2..d1f700c 100644 (file)
@@ -362,15 +362,6 @@ FilterGroup.prototype.getDefaultFilters = function () {
        return this.defaultFilters;
 };
 
-/**
- * This is for a single_option and string_options group types
- * it returns the value of the default
- *
- * @return {string} Value of the default
- */
-FilterGroup.prototype.getDefaulParamValue = function () {
-       return this.defaultParams[ this.getName() ];
-};
 /**
  * Get the messags defining the 'whats this' popup for this group
  *
@@ -423,21 +414,6 @@ FilterGroup.prototype.setConflicts = function ( conflicts ) {
        this.conflicts = conflicts;
 };
 
-/**
- * Set conflicts for each filter item in the group based on the
- * given conflict map
- *
- * @param {Object} conflicts Object representing the conflict map,
- *  keyed by the item name, where its value is an object for all its conflicts
- */
-FilterGroup.prototype.setFilterConflicts = function ( conflicts ) {
-       this.getItems().forEach( function ( filterItem ) {
-               if ( conflicts[ filterItem.getName() ] ) {
-                       filterItem.setConflicts( conflicts[ filterItem.getName() ] );
-               }
-       } );
-};
-
 /**
  * Check whether this item has a potential conflict with the given item
  *
@@ -871,7 +847,6 @@ FilterGroup.prototype.getView = function () {
 /**
  * Get the prefix used for the filter names inside this group.
  *
- * @param {string} [name] Filter name to prefix
  * @return {string} Group prefix
  */
 FilterGroup.prototype.getNamePrefix = function () {
index 8725f51..50057af 100644 (file)
@@ -64,11 +64,10 @@ FilterItem.prototype.getState = function () {
 /**
  * Get the message for the display area for the currently active conflict
  *
- * @private
  * @return {string} Conflict result message key
  */
 FilterItem.prototype.getCurrentConflictResultMessage = function () {
-       var details = {};
+       var details;
 
        // First look in filter's own conflicts
        details = this.getConflictDetails( this.getOwnConflicts(), 'globalDescription' );
index 07c484b..4b219de 100644 (file)
@@ -225,7 +225,7 @@ FiltersViewModel.prototype.getFirstConflictedItem = function () {
  */
 FiltersViewModel.prototype.initializeFilters = function ( filterGroups, views ) {
        var filterConflictResult, groupConflictResult,
-               allViews = {},
+               allViews,
                model = this,
                items = [],
                groupConflictMap = {},
index 4764bd8..ac5bbae 100644 (file)
@@ -147,8 +147,6 @@ ChangesLimitAndDateButtonWidget.prototype.onPopupDays = function ( filterName )
 
 /**
  * Respond to limit choose event
- *
- * @param {string} filterName Filter name
  */
 ChangesLimitAndDateButtonWidget.prototype.updateButtonLabel = function () {
        var message,
index 09b802e..78cd8f4 100644 (file)
@@ -28,7 +28,6 @@ var ChangesListWrapperWidget = function MwRcfiltersUiChangesListWrapperWidget(
        this.filtersViewModel = filtersViewModel;
        this.changesListViewModel = changesListViewModel;
        this.controller = controller;
-       this.highlightClasses = null;
 
        // Events
        this.filtersViewModel.connect( this, {
@@ -52,22 +51,6 @@ var ChangesListWrapperWidget = function MwRcfiltersUiChangesListWrapperWidget(
 
 OO.inheritClass( ChangesListWrapperWidget, OO.ui.Widget );
 
-/**
- * Get all available highlight classes
- *
- * @return {string[]} An array of available highlight class names
- */
-ChangesListWrapperWidget.prototype.getHighlightClasses = function () {
-       if ( !this.highlightClasses || !this.highlightClasses.length ) {
-               this.highlightClasses = this.filtersViewModel.getItemsSupportingHighlights()
-                       .map( function ( filterItem ) {
-                               return filterItem.getCssClass();
-                       } );
-       }
-
-       return this.highlightClasses;
-};
-
 /**
  * Respond to the highlight feature being toggled on and off
  *
index 6634e30..12d53bb 100644 (file)
@@ -6,7 +6,7 @@
  *
  * @constructor
  * @param {Object} [config] Configuration object
- * @param {Object} [events] Events to aggregate. The object represent the
+ * @cfg {Object} [events] Events to aggregate. The object represent the
  *  event name to aggregate and the event value to emit on aggregate for items.
  */
 var GroupWidget = function MwRcfiltersUiViewSwitchWidget( config ) {
index 4057c48..806b9a3 100644 (file)
@@ -262,7 +262,6 @@ SavedLinksListItemWidget.prototype.onInputChange = function ( value ) {
 /**
  * Save the name of the query
  *
- * @param {string} [value] The value to save
  * @fires edit
  */
 SavedLinksListItemWidget.prototype.save = function () {