Views queries are not properly altered

Created on 13 March 2024, 9 months ago
Updated 8 April 2024, 9 months ago

After update to the most recent version I noticed that some of the views results are returning nodes that do not match filter criteria.

Query generated with the most recent version of Trash:

SELECT DISTINCT "node_field_data"."created" AS "node_field_data_created", "node_field_data"."nid" AS "nid", 'listings:promotions' AS "view_name"
FROM
{node_field_data} "node_field_data"
LEFT JOIN {node__field_active} "node__field_active" ON node_field_data.nid = node__field_active.entity_id AND node__field_active.deleted = '0'
LEFT JOIN {node__field_this_is_also_a_promotion} "node__field_this_is_also_a_promotion" ON node_field_data.nid = node__field_this_is_also_a_promotion.entity_id AND node__field_this_is_also_a_promotion.deleted = '0'
WHERE (("node_field_data"."status" = '1') AND ("node_field_data"."type" IN ('promotion')) AND ("node__field_active"."field_active_value" = '1')) OR (("node_field_data"."status" = '1') AND ("node_field_data"."type" IN ('event')) AND ("node__field_this_is_also_a_promotion"."field_this_is_also_a_promotion_value" = '1')) OR ("node_field_data"."deleted" IS NULL)
ORDER BY "node_field_data_created" DESC
LIMIT 7 OFFSET 0

Query generated after Trash module has been uninstalled:

SELECT DISTINCT "node_field_data"."created" AS "node_field_data_created", "node_field_data"."nid" AS "nid", 'listings:promotions' AS "view_name"
FROM
{node_field_data} "node_field_data"
LEFT JOIN {node__field_active} "node__field_active" ON node_field_data.nid = node__field_active.entity_id AND node__field_active.deleted = '0'
LEFT JOIN {node__field_this_is_also_a_promotion} "node__field_this_is_also_a_promotion" ON node_field_data.nid = node__field_this_is_also_a_promotion.entity_id AND node__field_this_is_also_a_promotion.deleted = '0'
WHERE (("node_field_data"."status" = '1') AND ("node_field_data"."type" IN ('promotion')) AND ("node__field_active"."field_active_value" = '1')) OR (("node_field_data"."status" = '1') AND ("node_field_data"."type" IN ('event')) AND ("node__field_this_is_also_a_promotion"."field_this_is_also_a_promotion_value" = '1'))
ORDER BY "node_field_data_created" DESC
LIMIT 7 OFFSET 0

As you can see ("node_field_data"."deleted" IS NULL) is added in the wrong place and causing site content to bypass original filter criteria. And BTW, when there are too much content it crashing the website with 502 error so I am setting priority to "Critical".

I am attaching filter criteria here.

πŸ› Bug report
Status

Fixed

Version

3.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States dealancer Washington D.C.

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024