guard against some edge cases for allow/wait lists
This commit is contained in:
Родитель
024774fbea
Коммит
e625e6bee3
|
@ -42,8 +42,8 @@ async function addFeatureFlag(flag: FeatureFlag) {
|
||||||
is_enabled: flag.isEnabled,
|
is_enabled: flag.isEnabled,
|
||||||
description: flag.description,
|
description: flag.description,
|
||||||
dependencies: flag.dependencies,
|
dependencies: flag.dependencies,
|
||||||
allow_list: flag.allowList,
|
allow_list: flag.allowList?.map((email) => email.trim()).filter((e) => !!e),
|
||||||
wait_list: flag.waitList,
|
wait_list: flag.waitList?.map((email) => email.trim()).filter((e) => !!e),
|
||||||
expired_at: flag.expiredAt,
|
expired_at: flag.expiredAt,
|
||||||
owner: flag.owner,
|
owner: flag.owner,
|
||||||
};
|
};
|
||||||
|
@ -96,6 +96,7 @@ async function updateOwner(name: string, owner: string) {
|
||||||
}
|
}
|
||||||
|
|
||||||
async function updateAllowList(name: string, allowList: string[]) {
|
async function updateAllowList(name: string, allowList: string[]) {
|
||||||
|
allowList = allowList.map((email) => email.trim()).filter((e) => !!e);
|
||||||
log.info("updateAllowList", { name, allowList });
|
log.info("updateAllowList", { name, allowList });
|
||||||
const res = await knex("feature_flags")
|
const res = await knex("feature_flags")
|
||||||
.where("name", name)
|
.where("name", name)
|
||||||
|
@ -111,6 +112,7 @@ async function updateAllowList(name: string, allowList: string[]) {
|
||||||
}
|
}
|
||||||
|
|
||||||
async function updateWaitList(name: string, waitList: string[]) {
|
async function updateWaitList(name: string, waitList: string[]) {
|
||||||
|
waitList = waitList.map((email) => email.trim()).filter((e) => !!e);
|
||||||
log.info("updateWaitList", { name, waitList });
|
log.info("updateWaitList", { name, waitList });
|
||||||
const res = await knex("feature_flags")
|
const res = await knex("feature_flags")
|
||||||
.where("name", name)
|
.where("name", name)
|
||||||
|
|
Загрузка…
Ссылка в новой задаче