Actions
Defect #39991
closedFix "any" operator for text filters to exclude empty text values
Start date:
Due date:
% Done:
0%
Estimated time:
Resolution:
Fixed
Affected version:
Description
For example, filtering issues with any notes filter will include issues with blank notes.
Is this a specification?
I don't think the SQL journals.notes IS NOT NULL
is appropriate. A journal without notes has an empty string, not NULL.
Steps to reproduce:¶
- Load fixtures with
rake db:fixtures:load
. - Update some parameters of an issue without any notes, like issue #3 in fixtures.
- Filter issues with any string in the notes.
- The issue #3 is extracted, but it does not have notes containing a string.
Journal table in this example
mysql> select id,journalized_id,created_on,notes from journals;
+----+----------------+---------------------+--------------------------------------------------------------------------+
| id | journalized_id | created_on | notes |
+----+----------------+---------------------+--------------------------------------------------------------------------+
| 1 | 1 | 2023-12-28 00:00:00 | Journal notes |
| 2 | 1 | 2023-12-29 00:00:00 | Some notes with Redmine links: #2, r2. |
| 3 | 2 | 2023-12-29 00:00:00 | A comment with inline image: !picture.jpg! and a reference to #1 and r2. |
| 4 | 6 | 2023-12-29 00:00:00 | A comment with a private version. |
| 5 | 14 | 2023-12-29 00:00:00 | A comment on a private issue. |
| 10 | 3 | 2023-12-30 11:59:40 | |
+----+----------------+---------------------+--------------------------------------------------------------------------+
6 rows in set (0.01 sec)
Actual SQL generated by ‎IssueQuery::sql_for_notes_field
EXISTS (SELECT 1 FROM journals WHERE journals.journalized_type='Issue' AND journals.journalized_id=issues.id AND (journals.notes IS NOT NULL) AND ((journals.private_notes = FALSE OR journals.user_id = 1 OR (projects.status <> 9 AND projects.status <> 10))))
EXISTS (SELECT 1 FROM journals WHERE journals.journalized_type='Issue' AND journals.journalized_id=issues.id AND (journals.notes IS NOT NULL) AND ((journals.private_notes = FALSE OR journals.user_id = 1 OR (projects.status <> 9 AND projects.status <> 10))))
Environment:¶
Redmine version 5.1.1.stable Ruby version 3.2.2-p53 (2023-03-30) [x86_64-linux] Rails version 6.1.7.6 Environment development / productioin Database adapter Mysql2 / PostgreSQL
Files
Related issues
Updated by Go MAEDA 11 months ago
- Related to Defect #25077: Issue description filter's 'none' operator does not match issues with blank descriptions added
Updated by Go MAEDA 11 months ago
- File 39991.patch 39991.patch added
- Subject changed from Incorrect results when using "none" and "any" parameters in notes filter to Fix "any" operator for text filters to exclude empty text values
- Status changed from New to Confirmed
- Target version set to 5.0.8
The attached patch fixes the issue.
This bug affects not only with "notes" but also with other text fields.
Actions