From: jenkins-bot Date: Fri, 8 Sep 2017 17:31:27 +0000 (+0000) Subject: Merge "WLFilters: Respect default values" X-Git-Tag: 1.31.0-rc.0~2176 X-Git-Url: http://git.cyclocoop.org/?a=commitdiff_plain;h=df0c0f52e35b9ba4ce4b164d69755ca4af35b9b6;hp=5ae8ee5c1b108518ad7e769fa5e05207569bf1c7;p=lhc%2Fweb%2Fwiklou.git Merge "WLFilters: Respect default values" --- diff --git a/includes/changes/ChangesListBooleanFilter.php b/includes/changes/ChangesListBooleanFilter.php index 913bd3832f..dd62d7fd8e 100644 --- a/includes/changes/ChangesListBooleanFilter.php +++ b/includes/changes/ChangesListBooleanFilter.php @@ -235,10 +235,13 @@ class ChangesListBooleanFilter extends ChangesListFilter { * @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 @@ class ChangesListBooleanFilter extends ChangesListFilter { 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() ]; } }