aboutsummaryrefslogtreecommitdiffstats
path: root/web_src/js/features
diff options
context:
space:
mode:
authorGusted <williamzijl7@hotmail.com>2022-06-25 21:50:23 +0200
committerGitHub <noreply@github.com>2022-06-25 20:50:23 +0100
commit0b7b342ab0b3cd26d8eb4ffb7f2df2ce505bb2ac (patch)
treedec08513a8d320a5f59e573502d062b10cfc4ee8 /web_src/js/features
parentfb5ca1bf644c4cf3960ce8161ebc2250a82b08cc (diff)
downloadgitea-0b7b342ab0b3cd26d8eb4ffb7f2df2ce505bb2ac.tar.gz
gitea-0b7b342ab0b3cd26d8eb4ffb7f2df2ce505bb2ac.zip
Fix remove file on initial comment (#20127) (#20128)
Backport #20127 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. Fix #20115
Diffstat (limited to 'web_src/js/features')
-rw-r--r--web_src/js/features/common-global.js3
-rw-r--r--web_src/js/features/repo-legacy.js1
2 files changed, 3 insertions, 1 deletions
diff --git a/web_src/js/features/common-global.js b/web_src/js/features/common-global.js
index eb59bcbe38..a508db39c5 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 = $(`<input id="${data.uuid}" name="files" type="hidden">`).val(data.uuid);
$dropzone.find('.files').append(input);
});
diff --git a/web_src/js/features/repo-legacy.js b/web_src/js/features/repo-legacy.js
index 6cdde6a1e4..2bf80d5511 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 = $(`<input id="${data.uuid}" name="files" type="hidden">`).val(data.uuid);
$dropzone.find('.files').append(input);