Only call to DB if needed.
This commit is contained in:
parent
d9cd64831e
commit
dd5c2c5c76
|
@ -32,8 +32,11 @@ export async function creatorsInList(
|
|||
|
||||
// fetches groups if no provided, but is async and shouldn't be looped with
|
||||
export async function isCreatorAsync(user: User | ContextUser) {
|
||||
let groups: UserGroup[] = []
|
||||
if (user.userGroups) {
|
||||
const db = context.getGlobalDB()
|
||||
const groups = await db.getMultiple<UserGroup>(user.userGroups)
|
||||
groups = await db.getMultiple<UserGroup>(user.userGroups)
|
||||
}
|
||||
return isCreatorSync(user, groups)
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue