Skip to content

Commit e458693

Browse files
committed
Don’t show the cancel button when creating a new org if there are no non-deleted projects
1 parent 1cd9df8 commit e458693

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

apps/webapp/app/presenters/NewOrganizationPresenter.server.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,16 @@ export class NewOrganizationPresenter {
1010

1111
public async call({ userId }: { userId: User["id"] }) {
1212
const organizations = await this.#prismaClient.organization.findMany({
13+
select: {
14+
projects: {
15+
where: { deletedAt: null },
16+
},
17+
},
1318
where: { members: { some: { userId } } },
1419
});
1520

1621
return {
17-
hasOrganizations: organizations.length > 0,
22+
hasOrganizations: organizations.filter((o) => o.projects.length > 0).length > 0,
1823
};
1924
}
2025
}

0 commit comments

Comments
 (0)