File tree Expand file tree Collapse file tree 3 files changed +6
-10
lines changed
components/datarooms/settings/delete-dataroooom
api/teams/[teamId]/datarooms/[id] Expand file tree Collapse file tree 3 files changed +6
-10
lines changed Original file line number Diff line number Diff line change @@ -18,7 +18,6 @@ import { Input } from "@/components/ui/input";
18
18
import { Modal } from "@/components/ui/modal" ;
19
19
20
20
import { useAnalytics } from "@/lib/analytics" ;
21
- import { useMediaQuery } from "@/lib/utils/use-media-query" ;
22
21
23
22
function DeleteDataroomModal ( {
24
23
dataroomId,
@@ -38,8 +37,6 @@ function DeleteDataroomModal({
38
37
const [ deleting , setDeleting ] = useState ( false ) ;
39
38
40
39
async function deleteDataroom ( ) {
41
- const dataroomsCount = teamInfo ?. teams . length ?? 1 ;
42
-
43
40
return new Promise ( ( resolve , reject ) => {
44
41
setDeleting ( true ) ;
45
42
@@ -66,8 +63,6 @@ function DeleteDataroomModal({
66
63
} ) ;
67
64
}
68
65
69
- const { isMobile } = useMediaQuery ( ) ;
70
-
71
66
return (
72
67
< Modal
73
68
showModal = { showDeleteDataroomModal }
Original file line number Diff line number Diff line change @@ -134,9 +134,10 @@ export default async function handle(
134
134
user . userId === ( session . user as CustomUser ) . id ,
135
135
) ;
136
136
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
+ } ) ;
140
141
}
141
142
142
143
await prisma . dataroom . delete ( {
Original file line number Diff line number Diff line change @@ -19,7 +19,7 @@ export default function Settings() {
19
19
const teamInfo = useTeam ( ) ;
20
20
const teamId = teamInfo ?. currentTeam ?. id ;
21
21
22
- const { isDatarooms, isDataroomsPlus } = usePlan ( ) ;
22
+ const { isBusiness , isDatarooms, isDataroomsPlus } = usePlan ( ) ;
23
23
24
24
if ( ! dataroom ) {
25
25
return < div > Loading...</ div > ;
@@ -84,7 +84,7 @@ export default function Settings() {
84
84
}
85
85
/>
86
86
< DuplicateDataroom dataroomId = { dataroom . id } teamId = { teamId } />
87
- { isDatarooms || isDataroomsPlus ? (
87
+ { isBusiness || isDatarooms || isDataroomsPlus ? (
88
88
< DeleteDataroom
89
89
dataroomId = { dataroom . id }
90
90
dataroomName = { dataroom . name }
You can’t perform that action at this time.
0 commit comments