From 7f7c40b528dac9428972d64e84be4222922492ed Mon Sep 17 00:00:00 2001 From: Moriel Schottlender Date: Sat, 18 Mar 2017 11:39:36 -0700 Subject: [PATCH] RCFilters UI: Followup Ic97c7c6aae7: Only add state message if item is selected Unselected items are highlighted, and hence are not in actual conflict or coverage or inclusion states. Bug: T156427 Change-Id: Ie8b6020e6dc93b46e94d2bc2bebb71b56f1e3645 --- .../dm/mw.rcfilters.dm.FilterItem.js | 58 ++++++++++--------- 1 file changed, 30 insertions(+), 28 deletions(-) diff --git a/resources/src/mediawiki.rcfilters/dm/mw.rcfilters.dm.FilterItem.js b/resources/src/mediawiki.rcfilters/dm/mw.rcfilters.dm.FilterItem.js index 5f406bd94f..a066d9e917 100644 --- a/resources/src/mediawiki.rcfilters/dm/mw.rcfilters.dm.FilterItem.js +++ b/resources/src/mediawiki.rcfilters/dm/mw.rcfilters.dm.FilterItem.js @@ -161,35 +161,37 @@ var messageKey, details, superset, affectingItems = []; - if ( this.isConflicted() ) { - // First look in filter's own conflicts - details = this.getConflictDetails( this.getOwnConflicts() ); - if ( !details.message ) { - // Fall back onto conflicts in the group - details = this.getConflictDetails( this.getGroupModel().getConflicts() ); + if ( this.isSelected() ) { + if ( this.isConflicted() ) { + // First look in filter's own conflicts + details = this.getConflictDetails( this.getOwnConflicts() ); + if ( !details.message ) { + // Fall back onto conflicts in the group + details = this.getConflictDetails( this.getGroupModel().getConflicts() ); + } + + messageKey = details.message; + affectingItems = details.names; + } else if ( this.isIncluded() ) { + superset = this.getSuperset(); + // For this message we need to collect the affecting superset + affectingItems = this.getGroupModel().getSelectedItems( this ) + .filter( function ( item ) { + return superset.indexOf( item.getName() ) !== -1; + } ) + .map( function ( item ) { + return mw.msg( 'quotation-marks', item.getLabel() ); + } ); + + messageKey = 'rcfilters-state-message-subset'; + } else if ( this.isFullyCovered() ) { + affectingItems = this.getGroupModel().getSelectedItems( this ) + .map( function ( item ) { + return mw.msg( 'quotation-marks', item.getLabel() ); + } ); + + messageKey = 'rcfilters-state-message-fullcoverage'; } - - messageKey = details.message; - affectingItems = details.names; - } else if ( this.isIncluded() ) { - superset = this.getSuperset(); - // For this message we need to collect the affecting superset - affectingItems = this.getGroupModel().getSelectedItems( this ) - .filter( function ( item ) { - return superset.indexOf( item.getName() ) !== -1; - } ) - .map( function ( item ) { - return mw.msg( 'quotation-marks', item.getLabel() ); - } ); - - messageKey = 'rcfilters-state-message-subset'; - } else if ( this.isFullyCovered() ) { - affectingItems = this.getGroupModel().getSelectedItems( this ) - .map( function ( item ) { - return mw.msg( 'quotation-marks', item.getLabel() ); - } ); - - messageKey = 'rcfilters-state-message-fullcoverage'; } if ( messageKey ) { -- 2.20.1