Skip to content

Commit a0ba22c

Browse files
authored
Merge pull request #1550 from mfts/fix/delete-dr
feat: enable delete dataroom on business
2 parents 6bdd3f8 + 6316cb3 commit a0ba22c

File tree

3 files changed

+6
-10
lines changed

3 files changed

+6
-10
lines changed

components/datarooms/settings/delete-dataroooom/delete-dataroom-modal.tsx

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ import { Input } from "@/components/ui/input";
1818
import { Modal } from "@/components/ui/modal";
1919

2020
import { useAnalytics } from "@/lib/analytics";
21-
import { useMediaQuery } from "@/lib/utils/use-media-query";
2221

2322
function DeleteDataroomModal({
2423
dataroomId,
@@ -38,8 +37,6 @@ function DeleteDataroomModal({
3837
const [deleting, setDeleting] = useState(false);
3938

4039
async function deleteDataroom() {
41-
const dataroomsCount = teamInfo?.teams.length ?? 1;
42-
4340
return new Promise((resolve, reject) => {
4441
setDeleting(true);
4542

@@ -66,8 +63,6 @@ function DeleteDataroomModal({
6663
});
6764
}
6865

69-
const { isMobile } = useMediaQuery();
70-
7166
return (
7267
<Modal
7368
showModal={showDeleteDataroomModal}

pages/api/teams/[teamId]/datarooms/[id]/index.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -134,9 +134,10 @@ export default async function handle(
134134
user.userId === (session.user as CustomUser).id,
135135
);
136136
if (!isUserAdmin) {
137-
return res
138-
.status(403)
139-
.json({ message: "You are not permitted to perform this action" });
137+
return res.status(403).json({
138+
message:
139+
"You are not permitted to perform this action. Only admin and managers can delete datarooms.",
140+
});
140141
}
141142

142143
await prisma.dataroom.delete({

pages/datarooms/[id]/settings/index.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ export default function Settings() {
1919
const teamInfo = useTeam();
2020
const teamId = teamInfo?.currentTeam?.id;
2121

22-
const { isDatarooms, isDataroomsPlus } = usePlan();
22+
const { isBusiness, isDatarooms, isDataroomsPlus } = usePlan();
2323

2424
if (!dataroom) {
2525
return <div>Loading...</div>;
@@ -84,7 +84,7 @@ export default function Settings() {
8484
}
8585
/>
8686
<DuplicateDataroom dataroomId={dataroom.id} teamId={teamId} />
87-
{isDatarooms || isDataroomsPlus ? (
87+
{isBusiness || isDatarooms || isDataroomsPlus ? (
8888
<DeleteDataroom
8989
dataroomId={dataroom.id}
9090
dataroomName={dataroom.name}

0 commit comments

Comments
 (0)