Skip to content

Commit cef743b

Browse files
authored
Merge pull request #6145 from WoltLab/6.1-file-processor-delete-confirm
Ask the user if they really want to delete the file
2 parents 560572b + 519b844 commit cef743b

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

ts/WoltLabSuite/Core/Form/Builder/Field/Controller/FileProcessor.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import {
1717
} from "WoltLabSuite/Core/Component/File/Helper";
1818
import { clearPreviousErrors } from "WoltLabSuite/Core/Component/File/Upload";
1919
import { innerError } from "WoltLabSuite/Core/Dom/Util";
20+
import { confirmationFactory } from "WoltLabSuite/Core/Component/Confirmation";
2021

2122
type FileId = string;
2223
const fileProcessors = new Map<FileId, FileProcessor>();
@@ -130,6 +131,10 @@ export class FileProcessor {
130131
deleteButton.classList.add("button", "small");
131132
deleteButton.textContent = getPhrase("wcf.global.button.delete");
132133
deleteButton.addEventListener("click", async () => {
134+
if (!(await confirmationFactory().delete())) {
135+
return;
136+
}
137+
133138
const result = await deleteFile(element.fileId!);
134139
if (result.ok) {
135140
this.#unregisterFile(element);

wcfsetup/install/files/js/WoltLabSuite/Core/Form/Builder/Field/Controller/FileProcessor.js

Lines changed: 4 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)