Displaying confirmation modal when deleting tagged files, rather than just refusing to delete them.

This commit is contained in:
Roland 2026-04-14 10:40:24 -06:00
parent 4380cab88c
commit 8fb9e35aef
No known key found for this signature in database
GPG key ID: 1BA620CE6C9A4680
7 changed files with 133 additions and 55 deletions

View file

@ -1386,10 +1386,18 @@ export async function getFile(path, skipTracking = false) {
}
}
export async function deleteFile(paths) {
let body = {paths: paths};
export async function deleteFile(paths, force = false) {
let body = {paths: paths, force: force};
const response = await apiPost(`${API_URI}/files/delete`, body);
if (!response.ok) {
try {
const json = await response.clone().json();
if (json.code === 'FILE_GROUP_IS_TAGGED' && json.file_groups) {
return {tagged: true, file_groups: json.file_groups};
}
} catch (e) {
// Not JSON, fall through to generic error.
}
const message = await getErrorMessage(response, 'Failed to delete file. See server logs.');
toast({
type: 'error',