Skip to content

Commit

Permalink
Revert "Refactored src/flags.js getFlagIdsWithFilters"
Browse files Browse the repository at this point in the history
This reverts commit 5f0098c.
  • Loading branch information
Kayla Lei committed Sep 17, 2024
1 parent 195b86c commit f6d9d89
Showing 1 changed file with 5 additions and 11 deletions.
16 changes: 5 additions & 11 deletions src/flags.js
Original file line number Diff line number Diff line change
Expand Up @@ -134,14 +134,6 @@ 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 = [];
Expand All @@ -151,10 +143,12 @@ 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)) {
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}`);
}
}
console.log('KAYLA_LEI');

sets = (sets.length || orSets.length) ? sets : ['flags:datetime']; // No filter default

let flagIds = [];
Expand Down

0 comments on commit f6d9d89

Please sign in to comment.