fix
This commit is contained in:
parent
88965c8608
commit
14fb95c798
|
@ -146,19 +146,19 @@ function onDrop(ev: DragEvent) {
|
||||||
if (driveFile != null && driveFile !== '') {
|
if (driveFile != null && driveFile !== '') {
|
||||||
const file = JSON.parse(driveFile);
|
const file = JSON.parse(driveFile);
|
||||||
emit('removeFile', file.id);
|
emit('removeFile', file.id);
|
||||||
if (props.selectedFiles.length > 0) {
|
if (props.selectedFiles.length > 0) {
|
||||||
props.selectedFiles.forEach((e)=>{
|
props.selectedFiles.forEach((e) => {
|
||||||
misskeyApi('drive/files/update', {
|
misskeyApi('drive/files/update', {
|
||||||
fileId: e.id,
|
fileId: e.id,
|
||||||
folderId: props.folder.id,
|
folderId: props.folder.id,
|
||||||
});
|
});
|
||||||
})
|
});
|
||||||
}else{
|
} else {
|
||||||
misskeyApi('drive/files/update', {
|
misskeyApi('drive/files/update', {
|
||||||
fileId: file.id,
|
fileId: file.id,
|
||||||
folderId: props.folder.id,
|
folderId: props.folder.id,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//#endregion
|
//#endregion
|
||||||
|
|
||||||
|
@ -234,119 +234,111 @@ function rename() {
|
||||||
|
|
||||||
function deleteFolder() {
|
function deleteFolder() {
|
||||||
misskeyApi('drive/folders/show', {
|
misskeyApi('drive/folders/show', {
|
||||||
folderId: props.folder.id,
|
folderId: props.folder.id,
|
||||||
}).then(async (r) => {
|
}).then(async (r) => {
|
||||||
|
if (r.foldersCount > 0) {
|
||||||
|
await os.alert({
|
||||||
|
type: 'error',
|
||||||
|
title: i18n.ts.unableToDelete,
|
||||||
|
text: 'フォルダ内にフォルダが存在するため、削除できません。 \n フォルダ内のフォルダを削除してから試してみてください。',
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
if (r.foldersCount > 0) {
|
if (r.filesCount > 0) {
|
||||||
await os.alert({
|
const { canceled } = await os.confirm({
|
||||||
type: 'error',
|
type: 'warning',
|
||||||
title: i18n.ts.unableToDelete,
|
text: i18n.t('driveFolderDeleteConfirm', { name: props.folder.name }),
|
||||||
text: 'フォルダ内にフォルダが存在するため、削除できません。 \n フォルダ内のフォルダを削除してから試してみてください。',
|
});
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
if (r.filesCount > 0) {
|
if (canceled) return;
|
||||||
|
|
||||||
const {canceled} = await os.confirm({
|
|
||||||
type: 'warning',
|
|
||||||
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)
|
|
||||||
while (Result.length >= 31) {
|
|
||||||
const untilId = Result[Result.length - 1].id;
|
|
||||||
Result = await os.api('drive/files', { folderId: props.folder.id, limit: 31, untilId });
|
|
||||||
allResults = allResults.concat(Result); // pushをconcatに変更
|
|
||||||
}
|
|
||||||
allResults.forEach((r,i)=>{
|
|
||||||
os.api('drive/files/delete',{fileId: r.id})
|
|
||||||
})
|
|
||||||
|
|
||||||
|
let allResults = [];
|
||||||
|
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 misskeyApi('drive/files', { folderId: props.folder.id, limit: 31, untilId });
|
||||||
|
allResults = allResults.concat(Result); // pushをconcatに変更
|
||||||
|
}
|
||||||
|
allResults.forEach((r, i) => {
|
||||||
|
misskeyApi('drive/files/delete', { fileId: r.id });
|
||||||
|
});
|
||||||
|
|
||||||
misskeyApi('drive/folders/show', {
|
misskeyApi('drive/folders/show', {
|
||||||
folderId: props.folder.id,
|
folderId: props.folder.id,
|
||||||
}).then(async (r) =>{
|
}).then(async (r) => {
|
||||||
if (r.filesCount > 0) {
|
if (r.filesCount > 0) {
|
||||||
|
let allResults = [];
|
||||||
let allResults = [];
|
let Result = await misskeyApi('drive/files', { folderId: props.folder.id, limit: 31 });
|
||||||
let Result = await os.api('drive/files', {folderId: props.folder.id, limit: 31});
|
allResults = allResults.concat(Result);
|
||||||
allResults = allResults.concat(Result)
|
while (Result.length >= 31) {
|
||||||
while (Result.length >= 31) {
|
const untilId = Result[Result.length - 1].id;
|
||||||
const untilId = Result[Result.length - 1].id;
|
Result = await misskeyApi('drive/files', { folderId: props.folder.id, limit: 31, untilId });
|
||||||
Result = await os.api('drive/files', { folderId: props.folder.id, limit: 31, untilId });
|
allResults = allResults.concat(Result);
|
||||||
allResults = allResults.concat(Result);
|
}
|
||||||
}
|
allResults.forEach((r, i) => {
|
||||||
allResults.forEach((r,i)=>{
|
misskeyApi('drive/files/delete', { fileId: r.id });
|
||||||
os.api('drive/files/delete',{fileId: r.id})
|
});
|
||||||
})
|
|
||||||
|
|
||||||
misskeyApi('drive/folders/delete', {
|
misskeyApi('drive/folders/delete', {
|
||||||
folderId: props.folder.id,
|
folderId: props.folder.id,
|
||||||
}).then(() => {
|
}).then(() => {
|
||||||
if (defaultStore.state.uploadFolder === props.folder.id) {
|
if (defaultStore.state.uploadFolder === props.folder.id) {
|
||||||
defaultStore.set('uploadFolder', null);
|
defaultStore.set('uploadFolder', null);
|
||||||
}
|
}
|
||||||
}).catch(err => {
|
}).catch(err => {
|
||||||
switch (err.id) {
|
switch (err.id) {
|
||||||
case 'b0fc8a17-963c-405d-bfbc-859a487295e1':
|
case 'b0fc8a17-963c-405d-bfbc-859a487295e1':
|
||||||
os.alert({
|
os.alert({
|
||||||
type: 'error',
|
type: 'error',
|
||||||
title: i18n.ts.unableToDelete,
|
title: i18n.ts.unableToDelete,
|
||||||
text: i18n.ts.hasChildFilesOrFolders,
|
text: i18n.ts.hasChildFilesOrFolders,
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
os.alert({
|
os.alert({
|
||||||
type: 'error',
|
type: 'error',
|
||||||
text: i18n.ts.unableToDelete,
|
text: i18n.ts.unableToDelete,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
misskeyApi('drive/folders/delete', {
|
misskeyApi('drive/folders/delete', {
|
||||||
folderId: props.folder.id,
|
folderId: props.folder.id,
|
||||||
})
|
});
|
||||||
}else{
|
} else {
|
||||||
misskeyApi('drive/folders/delete', {
|
misskeyApi('drive/folders/delete', {
|
||||||
folderId: props.folder.id,
|
folderId: props.folder.id,
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
|
} else {
|
||||||
} else {
|
await misskeyApi('drive/folders/delete', {
|
||||||
|
folderId: props.folder.id,
|
||||||
await misskeyApi('drive/folders/delete', {
|
}).then(() => {
|
||||||
folderId: props.folder.id,
|
if (defaultStore.state.uploadFolder === props.folder.id) {
|
||||||
}).then(() => {
|
defaultStore.set('uploadFolder', null);
|
||||||
if (defaultStore.state.uploadFolder === props.folder.id) {
|
}
|
||||||
defaultStore.set('uploadFolder', null);
|
}).catch(err => {
|
||||||
}
|
switch (err.id) {
|
||||||
}).catch(err => {
|
case 'b0fc8a17-963c-405d-bfbc-859a487295e1':
|
||||||
switch (err.id) {
|
os.alert({
|
||||||
case 'b0fc8a17-963c-405d-bfbc-859a487295e1':
|
type: 'error',
|
||||||
os.alert({
|
title: i18n.ts.unableToDelete,
|
||||||
type: 'error',
|
text: i18n.ts.hasChildFilesOrFolders,
|
||||||
title: i18n.ts.unableToDelete,
|
});
|
||||||
text: i18n.ts.hasChildFilesOrFolders,
|
break;
|
||||||
});
|
default:
|
||||||
break;
|
os.alert({
|
||||||
default:
|
type: 'error',
|
||||||
os.alert({
|
text: i18n.ts.unableToDelete,
|
||||||
type: 'error',
|
});
|
||||||
text: i18n.ts.unableToDelete,
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function setAsUploadFolder() {
|
function setAsUploadFolder() {
|
||||||
defaultStore.set('uploadFolder', props.folder.id);
|
defaultStore.set('uploadFolder', props.folder.id);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue