diff --git a/dump.rdb b/dump.rdb new file mode 100644 index 0000000000..151d12b877 Binary files /dev/null and b/dump.rdb differ diff --git a/src/flags.js b/src/flags.js index 00bce1d9bd..f9bec7f629 100644 --- a/src/flags.js +++ b/src/flags.js @@ -134,6 +134,14 @@ Flags.getCount = async function ({ uid, filters, query }) { return flagIds.length; }; +function applyFlagFilters(type, sets, orSets, filters, uid) { + if (Flags._filters.hasOwnProperty(type)) { + Flags._filters[type](sets, orSets, filters[type], uid); + } else { + winston.warn(`[flags/list] No flag filter type found: ${type}`); + } +} + Flags.getFlagIdsWithFilters = async function ({ filters, uid, query }) { let sets = []; const orSets = []; @@ -143,12 +151,10 @@ Flags.getFlagIdsWithFilters = async function ({ filters, uid, query }) { filters.perPage = filters.hasOwnProperty('perPage') ? Math.abs(parseInt(filters.perPage, 10) || 20) : 20; for (const type of Object.keys(filters)) { - if (Flags._filters.hasOwnProperty(type)) { - Flags._filters[type](sets, orSets, filters[type], uid); - } else { - winston.warn(`[flags/list] No flag filter type found: ${type}`); - } + applyFlagFilters(type, sets, orSets, filters, uid); } + console.log('KAYLA_LEI'); + sets = (sets.length || orSets.length) ? sets : ['flags:datetime']; // No filter default let flagIds = [];