[MediaWiki-commits] [Gerrit] mediawiki/core[master]: WLFilters: Respect default values
jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/376719 ) Change subject: WLFilters: Respect default values .. WLFilters: Respect default values Followup to I3e48a9f2d9b70f0b9f6d7c6329db9c8e8001ee49 Reported in T174725#3590145 Comparing current value and active value with different representation ("1" !== true) leads to not applying filters that are ON by default. Bug: T174725 Change-Id: If083610c0294756589adfc32a59388cc7422ad5d --- M includes/changes/ChangesListBooleanFilter.php 1 file changed, 16 insertions(+), 5 deletions(-) Approvals: Catrope: Looks good to me, approved jenkins-bot: Verified diff --git a/includes/changes/ChangesListBooleanFilter.php b/includes/changes/ChangesListBooleanFilter.php index 913bd38..dd62d7f 100644 --- a/includes/changes/ChangesListBooleanFilter.php +++ b/includes/changes/ChangesListBooleanFilter.php @@ -235,10 +235,13 @@ * @inheritDoc */ public function isSelected( FormOptions $opts ) { - return !$opts[ $this->getName() ] && - array_filter( $this->getSiblings(), function ( $sibling ) use ( $opts ) { - return $opts[ $sibling->getName() ]; - } ); + return !$this->getValue( $opts ) && + array_filter( + $this->getSiblings(), + function ( ChangesListBooleanFilter $sibling ) use ( $opts ) { + return $sibling->getValue( $opts ); + } + ); } /** @@ -251,6 +254,14 @@ return false; } - return $opts[ $this->getName() ] === $this->activeValue; + return $this->getValue( $opts ) === $this->activeValue; + } + + /** +* @param FormOptions $opts +* @return bool The current value of this filter according to $opts but coerced to boolean +*/ + public function getValue( FormOptions $opts ) { + return (bool)$opts[ $this->getName() ]; } } -- To view, visit https://gerrit.wikimedia.org/r/376719 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: If083610c0294756589adfc32a59388cc7422ad5d Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/core Gerrit-Branch: master Gerrit-Owner: SbissonGerrit-Reviewer: Catrope Gerrit-Reviewer: jenkins-bot <> ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] mediawiki/core[master]: WLFilters: Respect default values
Sbisson has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/376719 ) Change subject: WLFilters: Respect default values .. WLFilters: Respect default values Followup to I3e48a9f2d9b70f0b9f6d7c6329db9c8e8001ee49 Reported in T174725#3590145 Comparing current value and active value with different representation ("1" !== true) leads to not applying filters that are ON by default. Bug: T174725 Change-Id: If083610c0294756589adfc32a59388cc7422ad5d --- M includes/changes/ChangesListBooleanFilter.php 1 file changed, 16 insertions(+), 5 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core refs/changes/19/376719/1 diff --git a/includes/changes/ChangesListBooleanFilter.php b/includes/changes/ChangesListBooleanFilter.php index 913bd38..dd62d7f 100644 --- a/includes/changes/ChangesListBooleanFilter.php +++ b/includes/changes/ChangesListBooleanFilter.php @@ -235,10 +235,13 @@ * @inheritDoc */ public function isSelected( FormOptions $opts ) { - return !$opts[ $this->getName() ] && - array_filter( $this->getSiblings(), function ( $sibling ) use ( $opts ) { - return $opts[ $sibling->getName() ]; - } ); + return !$this->getValue( $opts ) && + array_filter( + $this->getSiblings(), + function ( ChangesListBooleanFilter $sibling ) use ( $opts ) { + return $sibling->getValue( $opts ); + } + ); } /** @@ -251,6 +254,14 @@ return false; } - return $opts[ $this->getName() ] === $this->activeValue; + return $this->getValue( $opts ) === $this->activeValue; + } + + /** +* @param FormOptions $opts +* @return bool The current value of this filter according to $opts but coerced to boolean +*/ + public function getValue( FormOptions $opts ) { + return (bool)$opts[ $this->getName() ]; } } -- To view, visit https://gerrit.wikimedia.org/r/376719 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: If083610c0294756589adfc32a59388cc7422ad5d Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/core Gerrit-Branch: master Gerrit-Owner: Sbisson___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits