Robert Vogel has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/396330 )

Change subject: BSFoundation: Added applied status to filter
......................................................................


BSFoundation: Added applied status to filter

* applied can be set by any pre-filter functionality. So the filters do not 
match already filtered datasets
* Also fixed missing comparission in ListFilter

Change-Id: I437e235f4b3ef8496769d9260122022d50bc9ce1
---
M src/Data/Filter.php
M src/Data/Filter/ListValue.php
2 files changed, 29 insertions(+), 0 deletions(-)

Approvals:
  Robert Vogel: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/src/Data/Filter.php b/src/Data/Filter.php
index ea87ceb..fb05e53 100644
--- a/src/Data/Filter.php
+++ b/src/Data/Filter.php
@@ -31,6 +31,12 @@
 
        /**
         *
+        * @var boolean
+        */
+       protected $applied = false;
+
+       /**
+        *
         * @param array $params
         */
        public function __construct( $params ) {
@@ -69,9 +75,19 @@
         * @return boolean
         */
        public function matches( $dataSet ) {
+               if( $this->applied ) {
+                       return true;
+               }
                return $this->doesMatch( $dataSet );
        }
 
+       /**
+        *
+        * @param boolean $applied
+        */
+       public function setAppied( $applied = true ) {
+               $this->applied = $applied;
+       }
 
        /**
         *
diff --git a/src/Data/Filter/ListValue.php b/src/Data/Filter/ListValue.php
index 00bc7ca..c01040b 100644
--- a/src/Data/Filter/ListValue.php
+++ b/src/Data/Filter/ListValue.php
@@ -5,6 +5,18 @@
 use BlueSpice\Data\Filter;
 
 class ListValue extends Filter {
+       const COMPARISON_CONTAINS = 'ct';
+
+       /**
+        *
+        * @param array $params
+        */
+       public function __construct( $params ) {
+               if( !isset( $params[self::KEY_COMPARISON] ) ) {
+                       $params[self::KEY_COMPARISON] = 
static::COMPARISON_CONTAINS;
+               }
+               parent::__construct( $params );
+       }
 
        /**
         * Performs list filtering based on given filter of type array on a 
dataset
@@ -27,3 +39,4 @@
                return true;
        }
 }
+

-- 
To view, visit https://gerrit.wikimedia.org/r/396330
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I437e235f4b3ef8496769d9260122022d50bc9ce1
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/extensions/BlueSpiceFoundation
Gerrit-Branch: master
Gerrit-Owner: Pwirth <wi...@hallowelt.biz>
Gerrit-Reviewer: Robert Vogel <vo...@hallowelt.biz>
Gerrit-Reviewer: jenkins-bot <>

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

Reply via email to