mirror of
https://github.com/misskey-dev/misskey.git
synced 2026-06-03 00:14:07 +02:00
refactor
This commit is contained in:
@@ -119,7 +119,7 @@ async function _fetch_() {
|
||||
}
|
||||
|
||||
function postThis() {
|
||||
if (!file.value) return;
|
||||
if (file.value == null) return;
|
||||
|
||||
os.post({
|
||||
initialFiles: [file.value],
|
||||
@@ -127,11 +127,13 @@ function postThis() {
|
||||
}
|
||||
|
||||
function move() {
|
||||
if (!file.value) return;
|
||||
if (file.value == null) return;
|
||||
|
||||
const f = file.value;
|
||||
|
||||
selectDriveFolder(null).then(folder => {
|
||||
misskeyApi('drive/files/update', {
|
||||
fileId: file.value.id,
|
||||
fileId: f.id,
|
||||
folderId: folder[0] ? folder[0].id : null,
|
||||
}).then(async () => {
|
||||
await _fetch_();
|
||||
@@ -140,7 +142,7 @@ function move() {
|
||||
}
|
||||
|
||||
function toggleSensitive() {
|
||||
if (!file.value) return;
|
||||
if (file.value == null) return;
|
||||
|
||||
os.apiWithDialog('drive/files/update', {
|
||||
fileId: file.value.id,
|
||||
@@ -157,7 +159,9 @@ function toggleSensitive() {
|
||||
}
|
||||
|
||||
function rename() {
|
||||
if (!file.value) return;
|
||||
if (file.value == null) return;
|
||||
|
||||
const f = file.value;
|
||||
|
||||
os.inputText({
|
||||
title: i18n.ts.renameFile,
|
||||
@@ -166,7 +170,7 @@ function rename() {
|
||||
}).then(({ canceled, result: name }) => {
|
||||
if (canceled) return;
|
||||
os.apiWithDialog('drive/files/update', {
|
||||
fileId: file.value.id,
|
||||
fileId: f.id,
|
||||
name: name,
|
||||
}).then(async () => {
|
||||
await _fetch_();
|
||||
@@ -175,7 +179,9 @@ function rename() {
|
||||
}
|
||||
|
||||
async function describe() {
|
||||
if (!file.value) return;
|
||||
if (file.value == null) return;
|
||||
|
||||
const f = file.value;
|
||||
|
||||
const { dispose } = await os.popupAsyncWithDialog(import('@/components/MkFileCaptionEditWindow.vue').then(x => x.default), {
|
||||
default: file.value.comment ?? '',
|
||||
@@ -183,7 +189,7 @@ async function describe() {
|
||||
}, {
|
||||
done: caption => {
|
||||
os.apiWithDialog('drive/files/update', {
|
||||
fileId: file.value.id,
|
||||
fileId: f.id,
|
||||
comment: caption.length === 0 ? null : caption,
|
||||
}).then(async () => {
|
||||
await _fetch_();
|
||||
@@ -194,7 +200,7 @@ async function describe() {
|
||||
}
|
||||
|
||||
async function deleteFile() {
|
||||
if (!file.value) return;
|
||||
if (file.value == null) return;
|
||||
|
||||
const { canceled } = await os.confirm({
|
||||
type: 'warning',
|
||||
|
||||
Reference in New Issue
Block a user