Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Event type is created with calvideo instead of user default conferencing app #15441

Closed
Shaik-Sirajuddin opened this issue Jun 15, 2024 · 1 comment · Fixed by #15442
Closed
Labels
🐛 bug Something isn't working event-types area: event types, event-types
Milestone

Comments

@Shaik-Sirajuddin
Copy link
Contributor

Found a bug? Please fill out the sections below. 👍

Issue Summary

When creating a new event type, the event's location defaults to calvideo, even though the user has set Google Meet as the default conferencing app in the settings.

Steps to Reproduce

  1. Set google meet or any other app as default conferencing app in settings
  2. Create a new event type via homepage
  3. View event type location
Screencast.from.15-06-24.10.26.21.PM.IST.webm

Actual Results

  • CalVideo is used as location for newly created event type

Expected Results

  • It is expected to have to the users default conferencing app as location
@dosubot dosubot bot added event-types area: event types, event-types 🐛 bug Something isn't working labels Jun 15, 2024
Copy link

dosubot bot commented Jun 15, 2024

The event's location defaults to CalVideo when creating a new event type because the default location type is set to "conferencing," which should use the organizer's default conferencing app during booking. However, if the system does not correctly recognize or apply the Google Meet setting, it may fall back to a different default.

Ensure that the setDefaultConferencingApp function is correctly executed and that the appSlug for Google Meet is correctly passed and recognized by the system. Here is the relevant part of the function:

const setDefaultConferencingApp = async (userId: number, appSlug: string) => {
  const eventTypes = await getBulkEventTypes(userId);
  const eventTypeIds = eventTypes.eventTypes.map((item) => item.id);
  const foundApp = getAppFromSlug(appSlug);
  const appType = foundApp?.appData?.location?.type;

  if (!appType) {
    return;
  }

  const user = await prisma.user.findUnique({
    where: {
      id: userId,
    },
    select: {
      metadata: true,
      credentials: true,
    },
  });

  const currentMetadata = userMetadata.parse(user?.metadata);
  const credentialId = user?.credentials.find((item) => item.appId == appSlug)?.id;

  // Update the default conferencing app for the user.
  await prisma.user.update({
    where: {
      id: userId,
    },
    data: {
      metadata: {
        ...currentMetadata,
        defaultConferencingApp: {
          appSlug,
        },
      },
    },
  });

  await prisma.eventType.updateMany({
    where: {
      id: {
        in: eventTypeIds,
      },
      userId,
    },
    data: {
      locations: [{ type: appType, credentialId }] as LocationObject[],
    },
  });
};

Additionally, there is logging and error handling in place that could provide more insight into why the default conferencing app is not being applied correctly. Specifically, the updateDefaultAppMutation includes an onError callback that shows a toast message with the error details:

const updateDefaultAppMutation = trpc.viewer.updateUserDefaultConferencingApp.useMutation({
    onSuccess: () => {
      showToast("Default app updated successfully", "success");
      utils.viewer.getUsersDefaultConferencingApp.invalidate();
    },
    onError: (error) => {
      showToast(`Error: ${error.message}`, "error");
    },
  });

These error messages will be propagated to the client and displayed via the toast notifications, providing clear insights into what might be going wrong [1][2][3][4].

To continue talking to Dosu, mention @dosu.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 bug Something isn't working event-types area: event types, event-types
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant