cms icon indicating copy to clipboard operation
cms copied to clipboard

Conditions with null value doesn't get ignore

Open rezuankassim opened this issue 6 years ago • 1 comments

Bug Description

I am looping collection:items in my code and my Items collection have a boolean field — recommend and I wanted to display all the recommended items when I am visiting /items?recommend=true.

{{ collection:items :recommend:is="get:recommend" }}
    ...
{{ /collection:items }}

When I am visiting /items?recommend=true, the condition :recommend:is="get:recommend" works fine. But when I visit /items, the condition :recommend:is="get:recommend" does not get ignore when get:recommend return null, instead it shows items that is not recommend — recommend = false

How to Reproduce

  1. Add filter :recommend:is="get:recommend" in a collection tag
  2. Visit the route without any params
  3. The collection return on the page is records that fail the condition :recommend:is="get:recommend"

Extra Detail

Forum conversation:

  • https://statamic.com/forum/4869-url-query-in-collections-tag

Environment

Statamic version: 3.0.9 Pro Laravel version: 7.28.1 PHP version: 7.4.10

Install method (choose one):

  • Fresh install from statamic/statamic

rezuankassim avatar Sep 18 '20 02:09 rezuankassim

This issue has not had recent activity and has been marked as stale — by me, a robot. Simply reply to keep it open and send me away. If you do nothing, I will close it in a week. I have no feelings, so whatever you do is fine by me.

github-actions[bot] avatar Jan 17 '21 02:01 github-actions[bot]