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

feat(web): case insensitive slug search

Open heuels opened this issue 3 years ago • 10 comments

Not sure if this is something you want, but after upgrading we have lots of differently-cased event types that we still need to support 😞

heuels avatar Jun 23 '22 13:06 heuels

The latest updates on your projects. Learn more about Vercel for Git ↗︎

2 Ignored Deployments
Name Status Preview Updated
docs ⬜️ Ignored (Inspect) Jun 23, 2022 at 1:03PM (UTC)
ui ⬜️ Ignored (Inspect) Jun 23, 2022 at 1:03PM (UTC)

vercel[bot] avatar Jun 23 '22 13:06 vercel[bot]

@heuels 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 Jun 23 '22 13:06 vercel[bot]

I'd go as far to say it might be good to normalize always slugs to be lowercase and use only dash as separator? I know we recently had to cleanup some chars in event-slugs too... Thoughts @zomars ?

agustif avatar Jun 23 '22 17:06 agustif

@heuels by insensitive you mean 'THIS' === 'this' right?

zomars avatar Jun 23 '22 18:06 zomars

@zomars yes, that's right!

heuels avatar Jun 23 '22 18:06 heuels

@heuels @agustif I see this like something desirable yes. But we should make sure it is being used consistently in the codebase. Or find a way to enable this globally:

image

zomars avatar Jun 23 '22 18:06 zomars

@zomars we could add maybe a prisma middleware for this, that extends event-type calls adding the slug: { equals: slug, mode: "insensitive" }, where prop?

@heuels if you're up for it, you can checkout how we added soft-delete for bookingReference here https://github.com/calcom/cal.com/blob/main/packages/prisma/middleware/bookingReference.ts A similar approach could work for eventType-slug and maybe others in the future?

agustif avatar Jun 25 '22 10:06 agustif

@agustif yup, that sounds great! Will get to it later this week 🙌

heuels avatar Jun 27 '22 21:06 heuels

@heuels Were you done with your changes?

hariombalhara avatar Aug 08 '22 12:08 hariombalhara

@hariombalhara I have not sadly. We deprioritized using Cal.com for now and this has fallen off my radar. Should I just close this PR?

heuels avatar Aug 08 '22 16:08 heuels

This needs to be fixed in the middleware to catch the many, many different places we query things by slug. - further improvement but this will definitely stay on our radar for implementation. Thanks @heuels for the PR and ensuing discussions too.

emrysal avatar Aug 24 '22 13:08 emrysal