From 92ec5a5d13014816612eb13fcf94b6a2a8c588d5 Mon Sep 17 00:00:00 2001 From: silverwind Date: Mon, 18 Mar 2024 22:03:56 +0100 Subject: [PATCH 1/2] Prevent dropping onto project column 0 Fixes: https://github.com/go-gitea/gitea/issues/29853 Fixes: https://github.com/go-gitea/gitea/pull/29870 --- web_src/js/features/repo-projects.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/web_src/js/features/repo-projects.js b/web_src/js/features/repo-projects.js index 1f86711ab16e0..3cc41c5def2ab 100644 --- a/web_src/js/features/repo-projects.js +++ b/web_src/js/features/repo-projects.js @@ -63,6 +63,11 @@ async function initRepoProjectSortable() { ghostClass: 'card-ghost', delayOnTouchOnly: true, delay: 500, + onMove: (e) => { + // prevent dropping onto column 0 because it currently can not be moved and doing + // so would raise a 500 "project board does not exist" error on backend. + if (e.related.getAttribute('data-id') === '0') return false; + }, onSort: async () => { boardColumns = mainBoard.getElementsByClassName('project-column'); for (let i = 0; i < boardColumns.length; i++) { From 74466cff5548b15075a9005077c2009af376a192 Mon Sep 17 00:00:00 2001 From: silverwind Date: Mon, 18 Mar 2024 22:16:26 +0100 Subject: [PATCH 2/2] Update web_src/js/features/repo-projects.js --- web_src/js/features/repo-projects.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/web_src/js/features/repo-projects.js b/web_src/js/features/repo-projects.js index 3cc41c5def2ab..bd0e7d304fcad 100644 --- a/web_src/js/features/repo-projects.js +++ b/web_src/js/features/repo-projects.js @@ -66,7 +66,7 @@ async function initRepoProjectSortable() { onMove: (e) => { // prevent dropping onto column 0 because it currently can not be moved and doing // so would raise a 500 "project board does not exist" error on backend. - if (e.related.getAttribute('data-id') === '0') return false; + if (e.related?.getAttribute('data-id') === '0') return false; }, onSort: async () => { boardColumns = mainBoard.getElementsByClassName('project-column');