diff --git a/src/db/tables/featureFlags.ts b/src/db/tables/featureFlags.ts index 2d7b98177..158a33925 100644 --- a/src/db/tables/featureFlags.ts +++ b/src/db/tables/featureFlags.ts @@ -42,8 +42,8 @@ async function addFeatureFlag(flag: FeatureFlag) { is_enabled: flag.isEnabled, description: flag.description, dependencies: flag.dependencies, - allow_list: flag.allowList, - wait_list: flag.waitList, + allow_list: flag.allowList?.map((email) => email.trim()).filter((e) => !!e), + wait_list: flag.waitList?.map((email) => email.trim()).filter((e) => !!e), expired_at: flag.expiredAt, owner: flag.owner, }; @@ -96,6 +96,7 @@ async function updateOwner(name: string, owner: string) { } async function updateAllowList(name: string, allowList: string[]) { + allowList = allowList.map((email) => email.trim()).filter((e) => !!e); log.info("updateAllowList", { name, allowList }); const res = await knex("feature_flags") .where("name", name) @@ -111,6 +112,7 @@ async function updateAllowList(name: string, allowList: string[]) { } async function updateWaitList(name: string, waitList: string[]) { + waitList = waitList.map((email) => email.trim()).filter((e) => !!e); log.info("updateWaitList", { name, waitList }); const res = await knex("feature_flags") .where("name", name)