File tree Expand file tree Collapse file tree
modules/@apostrophecms/schema Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1212### Fixes
1313
1414* Fixes a bug in the login ` uponSubmit ` filter where a user could login without meeting the requirement.
15+ * Fixes pieces filters when values from optional fields are falsy.
1516
1617### Fixes
1718
Original file line number Diff line number Diff line change @@ -2101,13 +2101,15 @@ module.exports = {
21012101 const allChoices = await self . getChoices ( req , field ) ;
21022102 const values = await query . toDistinct ( field . name ) ;
21032103
2104- const choices = _ . map ( values , function ( value ) {
2105- const choice = _ . find ( allChoices , { value } ) ;
2106- return {
2107- value,
2108- label : choice && ( choice . label || value )
2109- } ;
2110- } ) ;
2104+ const choices = values
2105+ . filter ( Boolean )
2106+ . map ( value => {
2107+ const choice = _ . find ( allChoices , { value } ) ;
2108+ return {
2109+ value,
2110+ label : choice && ( choice . label || value )
2111+ } ;
2112+ } ) ;
21112113
21122114 self . apos . util . insensitiveSortByProperty ( choices , 'label' ) ;
21132115
You can’t perform that action at this time.
0 commit comments