[MediaWiki-commits] [Gerrit] mediawiki/core[wmf/1.30.0-wmf.17]: WLFilters: Respect default values

2017-09-12 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/377423 )

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
(cherry picked from commit 5e12ab58bec3844100e7407137d75a43add9b22d)

Change-Id: I23fdf90fb85cc5b0fb7a8b6fd4b4e4ca27ae0118
---
M includes/changes/ChangesListBooleanFilter.php
1 file changed, 16 insertions(+), 5 deletions(-)

Approvals:
  Hashar: 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/377423
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I23fdf90fb85cc5b0fb7a8b6fd4b4e4ca27ae0118
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: wmf/1.30.0-wmf.17
Gerrit-Owner: Sbisson 
Gerrit-Reviewer: Hashar 
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[wmf/1.30.0-wmf.17]: WLFilters: Respect default values

2017-09-12 Thread Sbisson (Code Review)
Sbisson has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/377423 )

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
(cherry picked from commit 5e12ab58bec3844100e7407137d75a43add9b22d)

Change-Id: I23fdf90fb85cc5b0fb7a8b6fd4b4e4ca27ae0118
---
M includes/changes/ChangesListBooleanFilter.php
1 file changed, 16 insertions(+), 5 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/23/377423/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/377423
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I23fdf90fb85cc5b0fb7a8b6fd4b4e4ca27ae0118
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: wmf/1.30.0-wmf.17
Gerrit-Owner: Sbisson 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] mediawiki/core[wmf/1.30.0-wmf.17]: WLFilters: Respect default values

2017-09-11 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/376766 )

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
(cherry picked from commit 5e12ab58bec3844100e7407137d75a43add9b22d)
---
M includes/changes/ChangesListBooleanFilter.php
1 file changed, 16 insertions(+), 5 deletions(-)

Approvals:
  Hashar: 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/376766
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: wmf/1.30.0-wmf.17
Gerrit-Owner: Sbisson 
Gerrit-Reviewer: Hashar 
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[wmf/1.30.0-wmf.17]: WLFilters: Respect default values

2017-09-08 Thread Sbisson (Code Review)
Sbisson has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/376766 )

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
(cherry picked from commit 5e12ab58bec3844100e7407137d75a43add9b22d)
---
M includes/changes/ChangesListBooleanFilter.php
1 file changed, 16 insertions(+), 5 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/66/376766/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/376766
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: wmf/1.30.0-wmf.17
Gerrit-Owner: Sbisson 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits