cal.com icon indicating copy to clipboard operation
cal.com copied to clipboard

feat: Enhance private link expiration with usage and date limits

Open retrogtx opened this issue 9 months ago • 5 comments

What does this PR do?

  • Fixes #19906 (GitHub issue number)
  • Fixes CAL-5283 (Linear issue number - should be visible at the bottom of the GitHub issue description)

https://www.loom.com/share/918768d71448470a9b19aeea8686917f?sid=74bfe2f6-73e1-4e7c-80e0-82386099bb5a

Mandatory Tasks (DO NOT REMOVE)

  • [ ] I have self-reviewed the code (A decent size PR without self-review might be rejected).
  • [x] 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. N/A.
  • [x] I confirm automated tests are in place that prove my fix is effective or that my feature works.

retrogtx avatar Mar 17 '25 05:03 retrogtx

@retrogtx is attempting to deploy a commit to the cal Team on Vercel.

A member of the Team first needs to authorize it.

vercel[bot] avatar Mar 17 '25 05:03 vercel[bot]

Graphite Automations

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

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

"Add community label" took an action on this PR • (03/17/25)

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

graphite-app[bot] avatar Mar 17 '25 05:03 graphite-app[bot]

@retrogtx You beat me on this :D. I was almost done with the implementation, i had implemented it differently as in instead of dropdown, just provided the max usage and expiry date field as input and then based on the values add the checks for expiry and also show the link expiry error message below the link. Anyways good job!

asadath1395 avatar Mar 17 '25 05:03 asadath1395

hey @asadath1395

thanks for trying, there are many other issues lying around along with bounties that might interest you

thank you again 🫡

retrogtx avatar Mar 17 '25 05:03 retrogtx

E2E results are ready!

github-actions[bot] avatar Mar 17 '25 05:03 github-actions[bot]

🫡 @alishaz-polymath everything's done

retrogtx avatar Mar 18 '25 05:03 retrogtx

That weird since one can't choose a previous date in the first place

image

retrogtx avatar Mar 18 '25 10:03 retrogtx

That weird since one can't choose a previous date in the first place

image

Yeah I updated the date directly in the DB for testing purposes.

alishaz-polymath avatar Mar 18 '25 10:03 alishaz-polymath

btw it has been implemented, done! @alishaz-polymath

retrogtx avatar Mar 18 '25 11:03 retrogtx

Looks

A few things failing:

  1. When I try to create multiple private links, say I have created 1 that expires on a certain date -> As soon as I try to "Add new link", I get error: Error: Rendered more hooks than during the previous render.
  2. The expiration date is not working. My expiration date is set to 15 of March 2025, yet I am able to access the booking page on 18th of March 2025
  3. Translation missing for link_expired_on_date
image

These issues seem to be addressed 🙏 Reviewing the code right now, but I am wondering if the flow where the expired private link leads to private link toggle being turned off is the desired flow here. @CarinaWolli Can you confirm if that's what we want?

alishaz-polymath avatar Mar 18 '25 12:03 alishaz-polymath

I have some UI suggestions. I think it would look cleaner if we don't show the 'Expires on' and 'Maximum number of uses' inputs and only have the gray text there:

Screenshot 2025-03-19 at 9 51 17 AM

Instead, open a Dialog after clicking the settings button and handle all settings in there. In the dialog you can either pick 'Usage-based or 'Time-based', by default it's a usage-based linked with Number of uses = 1

Let me know what you think about that

If I understand you correctly, the dialog where the user selects "time based" or "usage based", they get the exact number/date input there so that we don't see an input afterwards, right? I agree that's a lot cleaner yeah. Love it! @retrogtx what do you think?

alishaz-polymath avatar Mar 19 '25 09:03 alishaz-polymath

will make the changes 🫡

retrogtx avatar Mar 19 '25 09:03 retrogtx

things are ready! @alishaz-polymath @CarinaWolli

retrogtx avatar Mar 19 '25 11:03 retrogtx

Can we use the same radio buttons as here? Screenshot 2025-03-20 at 12 07 40 PM

Also I would remove 'single use' as an option and only have 'time-based' and 'usage-based'. The default is usage-based with 1 as the input

CarinaWolli avatar Mar 20 '25 11:03 CarinaWolli

on it

retrogtx avatar Mar 20 '25 11:03 retrogtx

image fixed, will push everything in a while!

retrogtx avatar Mar 20 '25 12:03 retrogtx

image fixed, will push everything in a while!

image Can we not have the input inline like so?

alishaz-polymath avatar Mar 20 '25 12:03 alishaz-polymath

yep working on that

retrogtx avatar Mar 20 '25 12:03 retrogtx

I have some UI suggestions. I think it would look cleaner if we don't show the 'Expires on' and 'Maximum number of uses' inputs and only have the gray text there:

Screenshot 2025-03-19 at 9 51 17 AM

Instead, open a Dialog after clicking the settings button and handle all settings in there. In the dialog you can either pick 'Usage-based or 'Time-based', by default it's a usage-based linked with Number of uses = 1

Let me know what you think about that

I thought about that dialog as it was mentioned here soo did not go with the inline approach initially

retrogtx avatar Mar 20 '25 12:03 retrogtx

I have some UI suggestions. I think it would look cleaner if we don't show the 'Expires on' and 'Maximum number of uses' inputs and only have the gray text there: Screenshot 2025-03-19 at 9 51 17 AM Instead, open a Dialog after clicking the settings button and handle all settings in there. In the dialog you can either pick 'Usage-based or 'Time-based', by default it's a usage-based linked with Number of uses = 1 Let me know what you think about that

I thought about that dialog as it was mentioned here soo did not go with the inline approach initially

Yeah I mean within the dialog itself, just have it as inline, just like the image shared by @CarinaWolli I think that's what she meant as well, she can correct me if I'm mistaken here. 🤚

alishaz-polymath avatar Mar 20 '25 12:03 alishaz-polymath

image alright, is this nice?

retrogtx avatar Mar 20 '25 12:03 retrogtx

image alright, is this nice?

I like this, deferring to @CarinaWolli for the final decision.

alishaz-polymath avatar Mar 20 '25 12:03 alishaz-polymath

image alright, is this nice?

This looks good 🙌🏻

CarinaWolli avatar Mar 20 '25 12:03 CarinaWolli

@retrogtx Type checks failing, I pulled it locally and I see a bunch of errors too in the MultiplePrivateLinksController file. Can you take a look?

alishaz-polymath avatar Mar 20 '25 13:03 alishaz-polymath

most of these are prettier errors from untouched files, strange

retrogtx avatar Mar 20 '25 13:03 retrogtx

gentle ping, @alishaz-polymath

retrogtx avatar Mar 27 '25 06:03 retrogtx

I have some design suggestions.

Before: Screenshot 2025-04-08 at 12 09 53 PM

After: Screenshot 2025-04-08 at 12 04 32 PM

  • also make use of our radio button component, it should look like that: Screenshot 2025-04-08 at 12 10 56 PM

CarinaWolli avatar Apr 08 '25 10:04 CarinaWolli

will be done 👍👍

retrogtx avatar Apr 08 '25 10:04 retrogtx

@retrogtx How is this looking? Is it ready for a review again?

alishaz-polymath avatar Apr 24 '25 03:04 alishaz-polymath

@alishaz-polymath it has always been ready!!

retrogtx avatar Apr 24 '25 03:04 retrogtx