mirror of
https://codeberg.org/PLG-Development/PLG-MuDiCS
synced 2026-07-06 00:47:09 +00:00
refactor(control): improve code quality
This commit is contained in:
@@ -59,7 +59,7 @@ export async function add_upload(
|
|||||||
};
|
};
|
||||||
const file_primary_key = get_file_primary_key(db_file);
|
const file_primary_key = get_file_primary_key(db_file);
|
||||||
|
|
||||||
if (Object.prototype.hasOwnProperty.call(file_transfer_tasks, file_primary_key))
|
if (Object.hasOwn(file_transfer_tasks, file_primary_key))
|
||||||
return show_already_in_tasks_error(db_file, 'upload'); // file is already in task
|
return show_already_in_tasks_error(db_file, 'upload'); // file is already in task
|
||||||
|
|
||||||
await db.files.put(db_file);
|
await db.files.put(db_file);
|
||||||
|
|||||||
@@ -59,9 +59,10 @@
|
|||||||
$effect(() => {
|
$effect(() => {
|
||||||
const s = $selected_file_ids;
|
const s = $selected_file_ids;
|
||||||
one_file_selected = liveQuery(async () => {
|
one_file_selected = liveQuery(async () => {
|
||||||
|
if (s.length !== 1) return false
|
||||||
const inode = await get_file_by_id(s[0]);
|
const inode = await get_file_by_id(s[0]);
|
||||||
if (!inode) return false;
|
if (!inode) return false;
|
||||||
return s.length === 1 && !is_folder(inode);
|
return !is_folder(inode);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user