Filter in View with User-ID
Steps to reproduce
- Create a simple list "MyTable" with only column "ToDo", Type "Text"
- Create a simple view "MyToDos" of table "MyTable" and select all columns ("ToDo" and Metadata fields)
- Create two Items by different user
- Select filter of column "Ersteller" with option "Ich (Benutzer-ID)" -> Result: Success
- Edit simple view "MyToDos" and select "Filter" and define column "Ersteller" = "Ich (Benutzer-ID)" -> Result: Unsuccess
- In View: no data
See Screenshots.
Expected behavior
My entries
Actual behavior
No data
Tables app version
0.6.6
Browser
Chrome, Version 120.0.6099.225 (Offizieller Build) (32-Bit)
Client operating system
Windows
Operating system
Linux 5.15.0-92-generic x86_64
Web server
None
PHP engine version
PHP 8.1
Database
MySQL
Additional info
I also observed this on cloud.nextcloud.com in the supported apps table for 'My apps'
Copy from https://github.com/nextcloud/tables/issues/869
We used to search case insensitive before but now we match exactly which is likely more the expected behaviour of a contains filter.
For our use case we should actually rather start implementing https://github.com/nextcloud/tables/issues/586
As a quick fix we could change the matching to insensitive or maybe rather split for two different filter comparisons
- contains (case-sensitive)
- contains (case-insensitive)
Quick hotfix could be this but needs some further checks if this doesn't have any sideeffects:
diff --git a/lib/Db/Row2Mapper.php b/lib/Db/Row2Mapper.php
index f34ef722..2be83e1e 100644
--- a/lib/Db/Row2Mapper.php
+++ b/lib/Db/Row2Mapper.php
@@ -329,7 +329,7 @@ class Row2Mapper {
$qb->expr()->like('value', $qb->createNamedParameter('%,'.$this->db->escapeLikeParameter($value).',%'))
));
}
- return $qb2->andWhere($qb->expr()->like('value', $qb->createNamedParameter('%'.$this->db->escapeLikeParameter($value).'%', $paramType)));
+ return $qb2->andWhere($qb->expr()->ilike('value', $qb->createNamedParameter('%'.$this->db->escapeLikeParameter($value).'%', $paramType)));
case 'is-equal':
if ($column->getType() === 'selection' && $column->getSubtype() === 'multi') {
$value = str_replace(['"', '\''], '', $value);