This commit is contained in:
mattyatea 2024-01-06 20:01:55 +09:00
parent 88965c8608
commit 14fb95c798

View file

@ -147,13 +147,13 @@ function onDrop(ev: DragEvent) {
const file = JSON.parse(driveFile);
emit('removeFile', file.id);
if (props.selectedFiles.length > 0) {
props.selectedFiles.forEach((e)=>{
props.selectedFiles.forEach((e) => {
misskeyApi('drive/files/update', {
fileId: e.id,
folderId: props.folder.id,
});
})
}else{
});
} else {
misskeyApi('drive/files/update', {
fileId: file.id,
folderId: props.folder.id,
@ -236,7 +236,6 @@ function deleteFolder() {
misskeyApi('drive/folders/show', {
folderId: props.folder.id,
}).then(async (r) => {
if (r.foldersCount > 0) {
await os.alert({
type: 'error',
@ -246,43 +245,40 @@ function deleteFolder() {
}
if (r.filesCount > 0) {
const {canceled} = await os.confirm({
const { canceled } = await os.confirm({
type: 'warning',
text: i18n.t('driveFolderDeleteConfirm', {name: props.folder.name}),
text: i18n.t('driveFolderDeleteConfirm', { name: props.folder.name }),
});
if (canceled) return;
let allResults = [];
let Result = await os.api('drive/files', {folderId: props.folder.id, limit: 31});
allResults = allResults.concat(Result)
let Result = await misskeyApi('drive/files', { folderId: props.folder.id, limit: 31 });
allResults = allResults.concat(Result);
while (Result.length >= 31) {
const untilId = Result[Result.length - 1].id;
Result = await os.api('drive/files', { folderId: props.folder.id, limit: 31, untilId });
Result = await misskeyApi('drive/files', { folderId: props.folder.id, limit: 31, untilId });
allResults = allResults.concat(Result); // pushconcat
}
allResults.forEach((r,i)=>{
os.api('drive/files/delete',{fileId: r.id})
})
allResults.forEach((r, i) => {
misskeyApi('drive/files/delete', { fileId: r.id });
});
misskeyApi('drive/folders/show', {
folderId: props.folder.id,
}).then(async (r) =>{
}).then(async (r) => {
if (r.filesCount > 0) {
let allResults = [];
let Result = await os.api('drive/files', {folderId: props.folder.id, limit: 31});
allResults = allResults.concat(Result)
let Result = await misskeyApi('drive/files', { folderId: props.folder.id, limit: 31 });
allResults = allResults.concat(Result);
while (Result.length >= 31) {
const untilId = Result[Result.length - 1].id;
Result = await os.api('drive/files', { folderId: props.folder.id, limit: 31, untilId });
Result = await misskeyApi('drive/files', { folderId: props.folder.id, limit: 31, untilId });
allResults = allResults.concat(Result);
}
allResults.forEach((r,i)=>{
os.api('drive/files/delete',{fileId: r.id})
})
allResults.forEach((r, i) => {
misskeyApi('drive/files/delete', { fileId: r.id });
});
misskeyApi('drive/folders/delete', {
folderId: props.folder.id,
@ -309,16 +305,14 @@ function deleteFolder() {
misskeyApi('drive/folders/delete', {
folderId: props.folder.id,
})
}else{
});
} else {
misskeyApi('drive/folders/delete', {
folderId: props.folder.id,
})
});
}
})
});
} else {
await misskeyApi('drive/folders/delete', {
folderId: props.folder.id,
}).then(() => {
@ -342,11 +336,9 @@ function deleteFolder() {
}
});
}
})
});
}
function setAsUploadFolder() {
defaultStore.set('uploadFolder', props.folder.id);
}