]> source.dussan.org Git - gitea.git/commitdiff
Add permission check for moving issue action in project view page (#24589)
authoryp05327 <576951401@qq.com>
Tue, 9 May 2023 04:50:16 +0000 (13:50 +0900)
committerGitHub <noreply@github.com>
Tue, 9 May 2023 04:50:16 +0000 (00:50 -0400)
Fix #22954
Only users who have write permission can move issues in the project view page.

templates/projects/view.tmpl
web_src/css/features/projects.css
web_src/js/features/repo-projects.js

index 705ce52d6c5bdbb65c4d99ee5b2960751415cf24..3274463435deffcef81fa47c8a94f7561a05b8d4 100644 (file)
@@ -73,7 +73,7 @@
        </div>
        <div class="ui container fluid padded" id="project-board">
 
-               <div class="board">
+               <div class="board {{if .CanWriteProjects}}sortable{{end}}">
                        {{range $board := .Boards}}
 
                        <div class="ui segment board-column" style="background: {{.Color}} !important;" data-id="{{.ID}}" data-sorting="{{.Sorting}}" data-url="{{$.Link}}/{{.ID}}">
index 2bc68ccf0dc16a2394d96010da3628f6fdab34f3..bd48429fa6c2c4c3809fcda3e4122cd4b076a412 100644 (file)
@@ -6,6 +6,10 @@
   margin: 0 0.5em;
 }
 
+.board.sortable .board-card {
+  cursor: move;
+}
+
 .board-column {
   background-color: var(--color-project-board-bg) !important;
   border: 1px solid var(--color-secondary) !important;
@@ -80,7 +84,6 @@
 .board-card {
   margin: 4px 2px !important;
   border-radius: 5px !important;
-  cursor: move;
   width: calc(100% - 4px) !important;
   padding: 0.5rem !important;
   min-height: auto !important;
index cd38c41e2da88457a24debce02fc17f1e353a8bf..11f5518283a98a881eaf33f2bcb82d457bcd0061 100644 (file)
@@ -36,7 +36,7 @@ function moveIssue({item, from, to, oldIndex}) {
 }
 
 async function initRepoProjectSortable() {
-  const els = document.querySelectorAll('#project-board > .board');
+  const els = document.querySelectorAll('#project-board > .board.sortable');
   if (!els.length) return;
 
   const {Sortable} = await import(/* webpackChunkName: "sortable" */'sortablejs');