fix: avatars not loading for org events (#10062)

This commit is contained in:
Hariom Balhara authored and GitHub committed 2023-07-11 14:23:07 +00:00
1 parent a73065ba5d
commit c2fceb2e0f
8 files changed
+36 -33

No files matched your search

@@ -2,6 +2,7 @@ import { useState } from "react";
import { shallow } from "zustand/shallow";
import { useFilterQuery } from "@calcom/features/bookings/lib/useFilterQuery";
import { useOrgBrandingValues } from "@calcom/features/ee/organizations/hooks";
import {
TeamsFilter,
FilterCheckboxFieldsContainer,
@@ -28,6 +29,8 @@ import { EventTypeFilter } from "./EventTypeFilter";
const PeopleFilter = () => {
const { t } = useLocale();
const orgBranding = useOrgBrandingValues();
const { data: query, pushItemToKey, removeItemByKeyAndValue, removeByKey } = useFilterQuery();
const [searchText, setSearchText] = useState("");
@@ -70,7 +73,11 @@ const PeopleFilter = () => {
icon={
<Avatar
alt={`${member?.id} avatar`}
imageSrc={member.username ? `${WEBAPP_URL}/${member.username}/avatar.png` : undefined}
imageSrc={
member.username
? `${orgBranding?.fullDomain ?? WEBAPP_URL}/${member.username}/avatar.png`
: undefined
}
size="xs"
/>
}
@@ -35,7 +35,7 @@ export const EventMembers = ({ schedulingType, users, profile }: EventMembersPro
const avatars: Avatar[] = shownUsers.map((user) => ({
title: `${user.name}`,
image: "image" in user ? `${user.image}` : `${CAL_URL}/${user.username}/avatar.png`,
image: "image" in user ? `${user.image}` : `/${user.username}/avatar.png`,
alt: user.name || undefined,
href: user.username ? `${CAL_URL}/${user.username}` : undefined,
}));
@@ -1,6 +1,6 @@
import { zodResolver } from "@hookform/resolvers/zod";
import type { Prisma } from "@prisma/client";
import { LinkIcon, Trash2 } from "lucide-react";
import { LinkIcon } from "lucide-react";
import { useRouter } from "next/router";
import { useState, useLayoutEffect } from "react";
import { Controller, useForm } from "react-hook-form";
@@ -19,9 +19,6 @@ import { trpc } from "@calcom/trpc/react";
import {
Avatar,
Button,
ConfirmationDialogContent,
Dialog,
DialogTrigger,
Form,
ImageUploader,
Label,
@@ -225,9 +222,9 @@ const OrgProfileView = () => {
</div>
</div>
)}
<hr className="border-subtle my-8 border" />
<div className="text-default mb-3 text-base font-semibold">{t("danger_zone")}</div>
{/* Disable Org disbanding */}
{/* <hr className="border-subtle my-8 border" />
<div className="text-default mb-3 text-base font-semibold">{t("danger_zone")}</div>
{currentOrganisation?.user.role === "OWNER" ? (
<Dialog>
<DialogTrigger asChild>
@@ -243,7 +240,7 @@ const OrgProfileView = () => {
{t("disband_org_confirmation_message")}
</ConfirmationDialogContent>
</Dialog>
) : null}
) : null} */}
{/* LEAVE ORG should go above here ^ */}
</>
)}
@@ -6,7 +6,6 @@ import { privacyFilteredLocations } from "@calcom/app-store/locations";
import { getAppFromSlug } from "@calcom/app-store/utils";
import { getBookingFieldsWithSystemFields } from "@calcom/features/bookings/lib/getBookingFields";
import { isRecurringEvent, parseRecurringEvent } from "@calcom/lib";
import { WEBAPP_URL } from "@calcom/lib/constants";
import { getDefaultEvent, getUsernameList } from "@calcom/lib/defaultEvents";
import { markdownToSafeHTML } from "@calcom/lib/markdownToSafeHTML";
import type { PrismaClient } from "@calcom/prisma/client";
@@ -137,7 +136,7 @@ export const getPublicEvent = async (
username: users[0].username,
name: users[0].name,
weekStart: users[0].weekStart,
image: `${WEBAPP_URL}/${users[0].username}/avatar.png`,
image: `/${users[0].username}/avatar.png`,
brandColor: users[0].brandColor,
darkBrandColor: users[0].darkBrandColor,
theme: null,
@@ -231,7 +230,7 @@ function getProfileFromEvent(event: Event) {
username,
name: profile.name,
weekStart,
image: team ? undefined : `${WEBAPP_URL}${basePath}/avatar.png`,
image: team ? undefined : `${basePath}/avatar.png`,
logo: !team ? undefined : team.logo,
brandColor: profile.brandColor,
darkBrandColor: profile.darkBrandColor,