Quick action implement (#13878)
* enhance(frontend): quick action for file admin-lookup * docs(changelog): update changelog * enhance(frontend): quick action for general admin-lookup, remove unimplemented note, instance admin-lookup * docs(changelog): update changelog * chore: fix lint
This commit is contained in:
@@ -63,3 +63,26 @@ export async function lookupUserByEmail() {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export async function lookupFile() {
|
||||
const { canceled, result: q } = await os.inputText({
|
||||
title: i18n.ts.fileIdOrUrl,
|
||||
minLength: 1,
|
||||
});
|
||||
if (canceled) return;
|
||||
|
||||
const show = (file) => {
|
||||
os.pageWindow(`/admin/file/${file.id}`);
|
||||
};
|
||||
|
||||
misskeyApi('admin/drive/show-file', q.startsWith('http://') || q.startsWith('https://') ? { url: q.trim() } : { fileId: q.trim() }).then(file => {
|
||||
show(file);
|
||||
}).catch(err => {
|
||||
if (err.code === 'NO_SUCH_FILE') {
|
||||
os.alert({
|
||||
type: 'error',
|
||||
text: i18n.ts.notFound,
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
Reference in New Issue
Block a user