Flow, UX and other improvements for hash my url feature (#2644)

* added toast feedback

* updated flow

* locale

* updated locale data

* removed unused booking call for reschedule flow

* fixed hashedURL test

* test adjustment

* further test changes

* added check in test to click check only if unchecked

* Added private link quick copy button

* fixed spacing

* fix lint

* consistency

* moved create hash function out of component render

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
This commit is contained in:
Syed Ali Shahbazandkodiakhq[bot] authored and GitHub committed 2022-05-09 16:41:07 +05:30
1 parent 5464d4c010
commit 9322b4ab4c
4 files changed
+60 -36

No files matched your search

@@ -1,6 +1,4 @@
import { EventTypeCustomInput, MembershipRole, PeriodType, Prisma } from "@prisma/client";
import short from "short-uuid";
import { v5 as uuidv5 } from "uuid";
import { z } from "zod";
import getAppKeysFromSlug from "@calcom/app-store/_utils/getAppKeysFromSlug";
@@ -88,7 +86,7 @@ const EventTypeUpdateInput = _EventTypeModel
}),
users: z.array(stringOrNumber).optional(),
schedule: z.number().optional(),
hashedLink: z.boolean(),
hashedLink: z.string(),
})
.partial()
.merge(
@@ -318,19 +316,16 @@ export const eventTypesRouter = createProtectedRouter()
if (hashedLink) {
// check if hashed connection existed. If it did, do nothing. If it didn't, add a new connection
if (!connectedLink) {
const translator = short();
const seed = `${input.eventName}:${input.id}:${new Date().getTime()}`;
const uid = translator.fromUUID(uuidv5(seed, uuidv5.URL));
// create a hashed link
await ctx.prisma.hashedLink.upsert({
where: {
eventTypeId: input.id,
},
update: {
link: uid,
link: hashedLink,
},
create: {
link: uid,
link: hashedLink,
eventType: {
connect: { id: input.id },
},