fix: org shell and org user settings avatars + org owner username (#11342)
This commit is contained in:
parent
f320e486a2
commit
bce62829b7
|
@ -5,6 +5,7 @@ import { usePathname, useRouter, useSearchParams } from "next/navigation";
|
|||
import type { ComponentProps } from "react";
|
||||
import React, { Suspense, useEffect, useState } from "react";
|
||||
|
||||
import { useOrgBranding } from "@calcom/features/ee/organizations/context/provider";
|
||||
import Shell from "@calcom/features/shell/Shell";
|
||||
import { classNames } from "@calcom/lib";
|
||||
import { HOSTED_CAL_FEATURES, WEBAPP_URL } from "@calcom/lib/constants";
|
||||
|
@ -16,7 +17,6 @@ import type { VerticalTabItemProps } from "@calcom/ui";
|
|||
import { Badge, Button, ErrorBoundary, Skeleton, useMeta, VerticalTabItem } from "@calcom/ui";
|
||||
import {
|
||||
ArrowLeft,
|
||||
Building,
|
||||
ChevronDown,
|
||||
ChevronRight,
|
||||
CreditCard,
|
||||
|
@ -76,7 +76,6 @@ const tabs: VerticalTabItemProps[] = [
|
|||
{
|
||||
name: "organization",
|
||||
href: "/settings/organizations",
|
||||
icon: Building,
|
||||
children: [
|
||||
{
|
||||
name: "profile",
|
||||
|
@ -137,6 +136,7 @@ const organizationRequiredKeys = ["organization"];
|
|||
const useTabs = () => {
|
||||
const session = useSession();
|
||||
const { data: user } = trpc.viewer.me.useQuery();
|
||||
const orgBranding = useOrgBranding();
|
||||
|
||||
const isAdmin = session.data?.user.role === UserPermissionRole.ADMIN;
|
||||
|
||||
|
@ -144,7 +144,10 @@ const useTabs = () => {
|
|||
if (tab.href === "/settings/my-account") {
|
||||
tab.name = user?.name || "my_account";
|
||||
tab.icon = undefined;
|
||||
tab.avatar = WEBAPP_URL + "/" + session?.data?.user?.username + "/avatar.png";
|
||||
tab.avatar = `${orgBranding?.fullDomain ?? WEBAPP_URL}/${session?.data?.user?.username}/avatar.png`;
|
||||
} else if (tab.href === "/settings/organizations") {
|
||||
tab.name = orgBranding?.name || "organization";
|
||||
tab.avatar = `${orgBranding?.fullDomain}/org/${orgBranding?.slug}/avatar.png`;
|
||||
} else if (
|
||||
tab.href === "/settings/security" &&
|
||||
user?.identityProvider === IdentityProvider.GOOGLE &&
|
||||
|
|
|
@ -833,7 +833,7 @@ function SideBar({ bannersHeight, user }: SideBarProps) {
|
|||
<div className="flex items-center gap-2 font-medium">
|
||||
<Avatar
|
||||
alt={`${orgBranding.name} logo`}
|
||||
imageSrc={`${orgBranding.fullDomain}/avatar.png`}
|
||||
imageSrc={`${orgBranding.fullDomain}/org/${orgBranding.slug}/avatar.png`}
|
||||
size="xsm"
|
||||
/>
|
||||
<p className="text line-clamp-1 text-sm">
|
||||
|
|
|
@ -14,6 +14,7 @@ import {
|
|||
WEBAPP_URL,
|
||||
} from "@calcom/lib/constants";
|
||||
import { getTranslation } from "@calcom/lib/server/i18n";
|
||||
import slugify from "@calcom/lib/slugify";
|
||||
import { prisma } from "@calcom/prisma";
|
||||
import { MembershipRole, UserPermissionRole } from "@calcom/prisma/enums";
|
||||
|
||||
|
@ -126,7 +127,7 @@ export const createHandler = async ({ input, ctx }: CreateOptions) => {
|
|||
|
||||
const createOwnerOrg = await prisma.user.create({
|
||||
data: {
|
||||
username: adminUsername,
|
||||
username: slugify(adminUsername),
|
||||
email: adminEmail,
|
||||
emailVerified: new Date(),
|
||||
password: hashedPassword,
|
||||
|
|
Loading…
Reference in New Issue
Block a user