update search logic
This commit is contained in:
@@ -74,12 +74,27 @@ export function FileSearchPanel(
|
|||||||
|
|
||||||
if (result?.content?.length) {
|
if (result?.content?.length) {
|
||||||
setSearchedUserFiles(result.content);
|
setSearchedUserFiles(result.content);
|
||||||
|
|
||||||
|
const hasOwned = result?.content.some((item: { owner: boolean }) => {
|
||||||
|
if (item.owner) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
});
|
||||||
|
|
||||||
|
if (hasOwned) {
|
||||||
|
if (fileType === 'image') {
|
||||||
|
setShowGlobalSearch(true);
|
||||||
|
handlerSearchGlobalFile(fileId, page);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
setSearchedUserFilesShowNull(true);
|
||||||
if (fileType === 'image') {
|
if (fileType === 'image') {
|
||||||
setShowGlobalSearch(true);
|
setShowGlobalSearch(true);
|
||||||
handlerSearchGlobalFile(fileId, page);
|
handlerSearchGlobalFile(fileId, page);
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
setSearchedUserFilesShowNull(true);
|
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user