Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
I added a new message type category (#2059533: How to create a Message category?) to filter messages by category in views. This Bug occured:
If I add a filter by message type category and use IN with the just inserted message type category and there is no message type of that category created, the filter will not apply and all messages will be displayed. I think this is due to the fact that instead of filtering by message type category the filter is converted to a IN() of message types that are inside of that message type category.
Comment | File | Size | Author |
---|---|---|---|
#6 | message-category-views-integration-2149527-6.patch | 1.1 KB | Rob230 |
#4 | message-category-views-integration-2149527-4.patch | 1.07 KB | Rob230 |
#1 | message-type-category-views.export.php_.txt | 2.08 KB | Andre-B |
Comments
Comment #1
Andre-BI added the export of that view
Comment #2
Andre-BComment #3
Rob230 CreditAttribution: Rob230 commentedI can confirm that this is the case.
The issue is that the SQL query takes the form:
If you have not created any message types for that particular category then the query won't have the WHERE clause, and thus will show all messages, such as those from other categories, which is incorrect behaviour.
It's not a major issue because really there shouldn't be cases on a production site where you have a message type category but no message types. It's the sort of thing that only occurs during development while you are setting things up.
Comment #4
Rob230 CreditAttribution: Rob230 commentedHere is a patch.
Comment #5
Rob230 CreditAttribution: Rob230 commentedThat might need some more thinking through. I've only covered the case where the user chose 'in' for the operator. For the case where the user has chosen 'not in', I think the correct behaviour should be to change the operator to 'in'.
Comment #6
Rob230 CreditAttribution: Rob230 commentedThe last patch had a bug in it as well. Try this one.
Comment #7
bluegeek9 CreditAttribution: bluegeek9 as a volunteer commented