From 6e22707bed12be15ec57669273910143d8ab0dc6 Mon Sep 17 00:00:00 2001 From: Gusted Date: Sat, 25 Jun 2022 01:35:20 +0200 Subject: [PATCH 1/2] Fix remove file on initial comment - Store the file uuid(which is returned by Gitea in the upload file response) onto the file object, so it can be used for the remove feature to specify this file. - Resolves #20115 --- web_src/js/features/common-global.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/web_src/js/features/common-global.js b/web_src/js/features/common-global.js index eb59bcbe38f7f..a508db39c5e6a 100644 --- a/web_src/js/features/common-global.js +++ b/web_src/js/features/common-global.js @@ -192,7 +192,8 @@ export function initGlobalDropzone() { thumbnailWidth: 480, thumbnailHeight: 480, init() { - this.on('success', (_file, data) => { + this.on('success', (file, data) => { + file.uuid = data.uuid; const input = $(``).val(data.uuid); $dropzone.find('.files').append(input); }); From 9e75aa13fb83e317bef3c6b8ae5b73078badee42 Mon Sep 17 00:00:00 2001 From: Gusted Date: Sat, 25 Jun 2022 02:41:33 +0200 Subject: [PATCH 2/2] Extend fix --- web_src/js/features/repo-legacy.js | 1 + 1 file changed, 1 insertion(+) diff --git a/web_src/js/features/repo-legacy.js b/web_src/js/features/repo-legacy.js index 6cdde6a1e4c27..2bf80d551141b 100644 --- a/web_src/js/features/repo-legacy.js +++ b/web_src/js/features/repo-legacy.js @@ -300,6 +300,7 @@ async function onEditContent(event) { thumbnailHeight: 480, init() { this.on('success', (file, data) => { + file.uuid = data.uuid; fileUuidDict[file.uuid] = {submitted: false}; const input = $(``).val(data.uuid); $dropzone.find('.files').append(input);