perf: Refactor getEnabledApps to filter on credentials passed (#10353)

Co-authored-by: Omar López <[email protected]>
Co-authored-by: Hariom Balhara <[email protected]>
This commit is contained in:
authored and GitHub committed 2023-08-01 16:40:52 +05:30
1 parent 88f542cb0d
commit 6fa54aba46
20 files changed
+76 -27

No files matched your search

+1 -1
View File
@@ -21,7 +21,7 @@ import getCalendarsEvents from "./getCalendarsEvents";
const log = logger.getChildLogger({ prefix: ["CalendarManager"] });
export const getCalendarCredentials = (credentials: Array<CredentialPayload>) => {
const calendarCredentials = getApps(credentials)
const calendarCredentials = getApps(credentials, true)
.filter((app) => app.type.endsWith("_calendar"))
.flatMap((app) => {
const credentials = app.credentials.flatMap((credential) => {
+1 -1
View File
@@ -75,7 +75,7 @@ export default class EventManager {
* @param user
*/
constructor(user: EventManagerUser) {
const appCredentials = getApps(user.credentials).flatMap((app) =>
const appCredentials = getApps(user.credentials, true).flatMap((app) =>
app.credentials.map((creds) => ({ ...creds, appName: app.name }))
);
// This includes all calendar-related apps, traditional calendars such as Google Calendar
+3
View File
@@ -176,6 +176,7 @@ const createMeetingWithCalVideo = async (calEvent: CalendarEvent) => {
appId: "daily-video",
type: "daily_video",
userId: null,
teamId: null,
key: dailyAppKeys,
invalid: false,
},
@@ -199,6 +200,7 @@ const getRecordingsOfCalVideoByRoomName = async (
appId: "daily-video",
type: "daily_video",
userId: null,
teamId: null,
key: dailyAppKeys,
invalid: false,
},
@@ -220,6 +222,7 @@ const getDownloadLinkOfCalVideoByRecordingId = async (recordingId: string) => {
appId: "daily-video",
type: "daily_video",
userId: null,
teamId: null,
key: dailyAppKeys,
invalid: false,
},