fix: showing default apps by Cal like Cal-Video in installed apps (#10611)
Co-authored-by: Satya Nishanth <satya@Satyas-MacBook-Pro.local> Co-authored-by: Joe Au-Yeung <65426560+joeauyeung@users.noreply.github.com>feat/fix-mobile-availability^2
parent
5f59ef2acf
commit
22b4bcdeeb
|
@ -4,6 +4,8 @@ import { prisma } from "@calcom/prisma";
|
||||||
|
|
||||||
import type { Prisma } from ".prisma/client";
|
import type { Prisma } from ".prisma/client";
|
||||||
|
|
||||||
|
type EnabledApp = ReturnType<typeof getApps>[number] & { enabled: boolean };
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param credentials - Can be user or team credentials
|
* @param credentials - Can be user or team credentials
|
||||||
|
@ -39,14 +41,13 @@ const getEnabledApps = async (credentials: CredentialDataWithTeamName[], filterO
|
||||||
select: { slug: true, enabled: true },
|
select: { slug: true, enabled: true },
|
||||||
});
|
});
|
||||||
const apps = getApps(credentials, filterOnCredentials);
|
const apps = getApps(credentials, filterOnCredentials);
|
||||||
|
const filteredApps = apps.reduce((reducedArray, app) => {
|
||||||
const filteredApps = enabledApps.reduce((reducedArray, app) => {
|
const appDbQuery = enabledApps.find((metadata) => metadata.slug === app.slug);
|
||||||
const appMetadata = apps.find((metadata) => metadata.slug === app.slug);
|
if (appDbQuery?.enabled || app.isGlobal) {
|
||||||
if (appMetadata) {
|
reducedArray.push({ ...app, enabled: true });
|
||||||
reducedArray.push({ ...appMetadata, enabled: app.enabled });
|
|
||||||
}
|
}
|
||||||
return reducedArray;
|
return reducedArray;
|
||||||
}, [] as (ReturnType<typeof getApps>[number] & { enabled: boolean })[]);
|
}, [] as EnabledApp[]);
|
||||||
|
|
||||||
return filteredApps;
|
return filteredApps;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue