Skip to content

feat: ✨ lock member default availability #22136

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

Open
wants to merge 42 commits into
base: main
Choose a base branch
from

Conversation

shaun-ak
Copy link
Contributor

@shaun-ak shaun-ak commented Jun 30, 2025

What does this PR do?

Video Demo (if applicable):

Screen.Recording.2025-07-01.at.8.57.37.AM.mp4

Mandatory Tasks (DO NOT REMOVE)

  • I have self-reviewed the code (A decent size PR without self-review might be rejected).
  • I have updated the developer docs in /docs if this PR makes changes that would require a documentation change. If N/A, write N/A here and check the checkbox.
  • I confirm automated tests are in place that prove my fix is effective or that my feature works.

Summary by cubic

Added a team setting to lock default availability, preventing team members from editing their default availability schedule unless they are an admin or owner.

  • New Features
    • Team admins can enable a lock to restrict members from changing their default availability.
    • Members see an error if they try to edit or delete their default schedule when the lock is active.
    • Added UI toggle for this setting in team settings.

@shaun-ak shaun-ak requested a review from a team as a code owner June 30, 2025 04:08
@shaun-ak shaun-ak marked this pull request as draft June 30, 2025 04:08
Copy link

vercel bot commented Jun 30, 2025

@shaun-ak is attempting to deploy a commit to the cal Team on Vercel.

A member of the Team first needs to authorize it.

@graphite-app graphite-app bot requested a review from a team June 30, 2025 04:08
@graphite-app graphite-app bot added the community Created by Linear-GitHub Sync label Jun 30, 2025
@github-actions github-actions bot added the ❗️ migrations contains migration files label Jun 30, 2025
@dosubot dosubot bot added the ✨ feature New feature or request label Jun 30, 2025
Copy link

graphite-app bot commented Jun 30, 2025

Graphite Automations

"Add consumer team as reviewer" took an action on this PR • (06/30/25)

1 reviewer was added to this PR based on Keith Williams's automation.

"Add community label" took an action on this PR • (06/30/25)

1 label was added to this PR based on Keith Williams's automation.

Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cubic found 3 issues across 13 files. Review them in cubic.dev

React with 👍 or 👎 to teach cubic. Tag @cubic-dev-ai to give specific feedback.

Copy link
Contributor

@Devanshusharma2005 Devanshusharma2005 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey can you please address the issues suggested by the cubic

@github-actions github-actions bot added consumer teams area: teams, round robin, collective, managed event-types labels Jul 1, 2025
@shaun-ak shaun-ak marked this pull request as ready for review July 1, 2025 04:03
@dosubot dosubot bot added the bookings area: bookings, availability, timezones, double booking label Jul 1, 2025
@shaun-ak
Copy link
Contributor Author

shaun-ak commented Jul 1, 2025

hey @Devanshusharma2005 , I have addressed the review comments by cubic.

Also added a video for reference.

Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cubic reviewed 13 files and found no issues. Review PR in cubic.dev.

Copy link
Contributor

@Devanshusharma2005 Devanshusharma2005 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

okay . Lets wait for @anikdhabal review too.

Copy link
Contributor

@kart1ka kart1ka left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Left a comment. Need clarification from the team. The rest of the code looks good to me.

Copy link
Contributor

@kart1ka kart1ka left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In a team inside an org, when a team admin/owner tries to update their own default availability, no error is shown. Default Availability does not update but on the frontend no error is shown.

https://cap.link/sca2b78tdqjecpr

@shaun-ak
Copy link
Contributor Author

shaun-ak commented Jul 3, 2025

Hey @kart1ka , I was trying to set up an organization following this Guide so that I could recreate this issue, seems like I need a License key to set up an org and I think one is not available for open source.

Can you please help me with this.

Thanks!

@kart1ka
Copy link
Contributor

kart1ka commented Jul 3, 2025

@shaun-ak you can check the docs here: https://cal.com/docs/self-hosting/license-key

@shaun-ak
Copy link
Contributor Author

shaun-ak commented Jul 4, 2025

Hey @kart1ka , I am trying to use the key from docs but getting "Invalid License Key" error.

cap.link/hzkkj76x5693ahn

@shaun-ak shaun-ak marked this pull request as ready for review July 25, 2025 03:47
@shaun-ak
Copy link
Contributor Author

shaun-ak commented Jul 25, 2025

Thanks for the detailed feedback, @CarinaWolli.
I've addressed all the points and also disabled the "Set to default" switch for non-default schedules.

Let me know if there's anything else you'd like to tweak!

Here's a video recording of the changes -- https://cap.link/kmthe6t070472r7

@shaun-ak shaun-ak requested a review from CarinaWolli July 25, 2025 03:52
@kart1ka
Copy link
Contributor

kart1ka commented Jul 29, 2025

Thanks for the detailed feedback, @CarinaWolli. I've addressed all the points and also disabled the "Set to default" switch for non-default schedules.

Let me know if there's anything else you'd like to tweak!

Here's a video recording of the changes -- cap.link/kmthe6t070472r7

When profile timezone is updated, the default timezone is also updated when locked default availability is on.
See the video: https://cap.link/31knrngrzp224vh

Pls make sure the changes work for both profile timezone update and the travel schedule update.

@kart1ka kart1ka marked this pull request as draft July 29, 2025 04:46
Copy link
Contributor

@kart1ka kart1ka left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

left a comment

@shaun-ak
Copy link
Contributor Author

Default.availability.1.mp4

Hey @kart1ka , for me the scenario is working fine, was there any specific testing path that you followed?

Attached a video of my local testing.

@shaun-ak shaun-ak marked this pull request as ready for review July 30, 2025 04:01
@shaun-ak shaun-ak requested a review from kart1ka July 30, 2025 14:42
Copy link
Contributor

@kart1ka kart1ka left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Everything seems to be working fine. Can you please add some tests to verify the logic works?

@shaun-ak
Copy link
Contributor Author

shaun-ak commented Aug 1, 2025

Hey @kart1ka , I have added test cases for lockedDefaultAvailability file. commit-- 318cccf

@shaun-ak shaun-ak requested a review from kart1ka August 1, 2025 02:55
@shaun-ak shaun-ak requested a review from CarinaWolli August 4, 2025 04:38
Copy link
Member

@CarinaWolli CarinaWolli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @shaun-ak, everything works great. One more thing: we just decided to make this feature available only for organizations. It’s still a team-wide setting, but we want to offer it only for teams within an organization. Could you add that as well? 🙏

@shaun-ak
Copy link
Contributor Author

Sure @CarinaWolli , will make it work for only organizations.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bookings area: bookings, availability, timezones, double booking community Created by Linear-GitHub Sync consumer ✨ feature New feature or request Medium priority Created by Linear-GitHub Sync ❗️ migrations contains migration files teams area: teams, round robin, collective, managed event-types
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Lock member's default availability
5 participants