feat: Pending members selection (#10168)
* Pending members selection * Discard changes to .vscode/launch.json * revert yarn.lock --------- Co-authored-by: Omar López <[email protected]>
This commit is contained in:
1 parent
d2104dac5a
commit
8ba4b4d50e
5 files changed
+38
-24
No files matched your search
@@ -62,12 +62,12 @@ export const ChildrenEventTypeSelect = ({
|
||||
size="mdLg"
|
||||
className="overflow-visible"
|
||||
imageSrc={`${CAL_URL}/${children.owner.username}/avatar.png`}
|
||||
alt={children.owner.name || ""}
|
||||
alt={children.owner.name || children.owner.email || ""}
|
||||
/>
|
||||
<div className="flex w-full flex-row justify-between">
|
||||
<div className="flex flex-col">
|
||||
<span className="text text-sm font-semibold leading-none">
|
||||
{children.owner.name}
|
||||
{children.owner.name || children.owner.email}
|
||||
<div className="flex flex-row gap-1">
|
||||
{children.owner.membership === MembershipRole.OWNER ? (
|
||||
<Badge variant="gray">{t("owner")}</Badge>
|
||||
@@ -77,9 +77,11 @@ export const ChildrenEventTypeSelect = ({
|
||||
{children.hidden && <Badge variant="gray">{t("hidden")}</Badge>}
|
||||
</div>
|
||||
</span>
|
||||
<small className="text-subtle font-normal leading-normal">
|
||||
{`/${children.owner.username}/${children.slug}`}
|
||||
</small>
|
||||
{children.owner.username && (
|
||||
<small className="text-subtle font-normal leading-normal">
|
||||
{`/${children.owner.username}/${children.slug}`}
|
||||
</small>
|
||||
)}
|
||||
</div>
|
||||
<div className="flex flex-row items-center gap-2">
|
||||
<Tooltip content={t("show_eventtype_on_profile")}>
|
||||
@@ -97,7 +99,7 @@ export const ChildrenEventTypeSelect = ({
|
||||
</div>
|
||||
</Tooltip>
|
||||
<ButtonGroup combined>
|
||||
{children.created && (
|
||||
{children.created && children.owner.username && (
|
||||
<Tooltip content={t("preview")}>
|
||||
<Button
|
||||
color="secondary"
|
||||
|
||||
@@ -117,9 +117,6 @@ export default async function getEventTypeById({
|
||||
slug: true,
|
||||
parentId: true,
|
||||
members: {
|
||||
where: {
|
||||
accepted: true,
|
||||
},
|
||||
select: {
|
||||
role: true,
|
||||
user: {
|
||||
@@ -356,7 +353,11 @@ export default async function getEventTypeById({
|
||||
...member.user,
|
||||
avatar: `${CAL_URL}/${member.user.username}/avatar.png`,
|
||||
};
|
||||
return { ...user, eventTypes: user.eventTypes.map((evTy) => evTy.slug), membership: member.role };
|
||||
return {
|
||||
...user,
|
||||
eventTypes: user.eventTypes.map((evTy) => evTy.slug),
|
||||
membership: member.role,
|
||||
};
|
||||
})
|
||||
: [];
|
||||
|
||||
|
||||
@@ -67,6 +67,7 @@ export const updateHandler = async ({ ctx, input }: UpdateOptions) => {
|
||||
select: {
|
||||
name: true,
|
||||
id: true,
|
||||
parentId: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -187,7 +188,8 @@ export const updateHandler = async ({ ctx, input }: UpdateOptions) => {
|
||||
const teamMemberIds = memberships.map((membership) => membership.userId);
|
||||
// guard against missing IDs, this may mean a member has just been removed
|
||||
// or this request was forged.
|
||||
if (!hosts.every((host) => teamMemberIds.includes(host.userId))) {
|
||||
// we let this pass through on organization sub-teams
|
||||
if (!hosts.every((host) => teamMemberIds.includes(host.userId)) && !eventType.team?.parentId) {
|
||||
throw new TRPCError({
|
||||
code: "FORBIDDEN",
|
||||
});
|
||||
|
||||
Reference in new issue
Block a user