Fix "User Added Question" Label in Email and Calendar Invite (#7559)

* Show label in email and calendar invite and send label as well as name in webhook

* Make common code reusable

---------

Co-authored-by: Peer Richelsen <[email protected]>
This commit is contained in:
Hariom BalharaandPeer Richelsen authored and GitHub committed 2023-03-07 17:50:54 +00:00
1 parent 6f8ea490d0
commit ce8e1d52da
6 files changed
+75 -22

No files matched your search

@@ -1,16 +1,17 @@
import getLabelValueMapFromResponses from "@calcom/lib/getLabelValueMapFromResponses";
import type { CalendarEvent } from "@calcom/types/Calendar";
import { Info } from "./Info";
export function UserFieldsResponses(props: { calEvent: CalendarEvent }) {
const { customInputs, userFieldsResponses } = props.calEvent;
const responses = userFieldsResponses || customInputs;
if (!responses) return null;
const labelValueMap = getLabelValueMapFromResponses(props.calEvent);
if (!labelValueMap) return null;
return (
<>
{Object.keys(responses).map((key) =>
responses[key] !== "" ? (
<Info key={key} label={key} description={`${responses[key]}`} withSpacer />
{Object.keys(labelValueMap).map((key) =>
labelValueMap[key] !== "" ? (
<Info key={key} label={key} description={`${labelValueMap[key]}`} withSpacer />
) : null
)}
</>