File tree Expand file tree Collapse file tree 5 files changed +21
-10
lines changed Expand file tree Collapse file tree 5 files changed +21
-10
lines changed Original file line number Diff line number Diff line change @@ -18,7 +18,7 @@ export async function moveVideoToFolder({
1818} : {
1919 videoId : Video . VideoId ;
2020 folderId : Folder . FolderId | null ;
21- spaceId : Space . SpaceIdOrOrganisationId | null ;
21+ spaceId ? : Space . SpaceIdOrOrganisationId | null ;
2222} ) {
2323 const user = await getCurrentUser ( ) ;
2424 if ( ! user || ! user . activeOrganizationId )
Original file line number Diff line number Diff line change @@ -56,7 +56,13 @@ export async function removeVideosFromSpace(
5656 const folderRows = await db ( )
5757 . select ( { id : folders . id } )
5858 . from ( folders )
59- . where ( isNull ( folders . spaceId ) ) ;
59+ . where (
60+ and (
61+ isNull ( folders . spaceId ) ,
62+ eq ( folders . organizationId , user . activeOrganizationId ) ,
63+ ) ,
64+ ) ;
65+
6066 const folderIds = folderRows . map ( ( f ) => f . id ) ;
6167
6268 if ( folderIds . length > 0 ) {
@@ -85,7 +91,13 @@ export async function removeVideosFromSpace(
8591 const folderRows = await db ( )
8692 . select ( { id : folders . id } )
8793 . from ( folders )
88- . where ( eq ( folders . spaceId , spaceId ) ) ;
94+ . where (
95+ and (
96+ isNull ( folders . spaceId ) ,
97+ eq ( folders . organizationId , user . activeOrganizationId ) ,
98+ ) ,
99+ ) ;
100+
89101 const folderIds = folderRows . map ( ( f ) => f . id ) ;
90102
91103 if ( folderIds . length > 0 ) {
Original file line number Diff line number Diff line change @@ -21,7 +21,7 @@ export type FolderDataType = {
2121 id : Folder . FolderId ;
2222 color : "normal" | "blue" | "red" | "yellow" ;
2323 videoCount : number ;
24- spaceId : Space . SpaceIdOrOrganisationId ;
24+ spaceId ? : Space . SpaceIdOrOrganisationId | null ;
2525 parentId : Folder . FolderId | null ;
2626} ;
2727
Original file line number Diff line number Diff line change @@ -15,7 +15,7 @@ import { registerDropTarget } from "./ClientCapCard";
1515export function ClientMyCapsLink ( {
1616 spaceId,
1717} : {
18- spaceId : Space . SpaceIdOrOrganisationId ;
18+ spaceId ? : Space . SpaceIdOrOrganisationId ;
1919} ) {
2020 const [ isDragOver , setIsDragOver ] = useState ( false ) ;
2121 const [ isMovingVideo , setIsMovingVideo ] = useState ( false ) ;
@@ -94,11 +94,11 @@ export function ClientMyCapsLink({
9494 await moveVideoToFolder ( {
9595 videoId : capData . id ,
9696 folderId : null ,
97- spaceId,
97+ spaceId : spaceId ?? null ,
9898 } ) ;
9999 router . refresh ( ) ;
100- if ( spaceId ) {
101- toast . success ( `Moved "${ capData . name } " to "${ spaceId } "` ) ;
100+ if ( activeSpace ) {
101+ toast . success ( `Moved "${ capData . name } " to "${ activeSpace . name } "` ) ;
102102 } else {
103103 toast . success ( `Moved "${ capData . name } " to My Caps` ) ;
104104 }
Original file line number Diff line number Diff line change @@ -43,7 +43,7 @@ const FolderPage = async ({
4343 </ div >
4444 < div className = "flex justify-between items-center mb-6 w-full" >
4545 < div className = "flex overflow-x-auto items-center font-medium" >
46- < ClientMyCapsLink spaceId = { params . spaceId } />
46+ < ClientMyCapsLink />
4747
4848 { breadcrumb . map ( ( folder , index ) => (
4949 < div key = { folder . id } className = "flex items-center" >
@@ -72,7 +72,6 @@ const FolderPage = async ({
7272 key = { folder . id }
7373 name = { folder . name }
7474 color = { folder . color }
75- spaceId = { params . spaceId }
7675 id = { folder . id }
7776 parentId = { folder . parentId }
7877 videoCount = { folder . videoCount }
You can’t perform that action at this time.
0 commit comments