diff options
author | qwerty287 <80460567+qwerty287@users.noreply.github.com> | 2023-03-28 19:23:25 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-03-28 13:23:25 -0400 |
commit | 3cab9c6b0c050bfcb9f2f067e7dc1b0242875254 (patch) | |
tree | 0a781efb66090c244fece965cd7dfe3c57c6cb5e /templates/repo | |
parent | 85e8c837b8472ec20e657d2a7ebc6c78c04bffae (diff) | |
download | gitea-3cab9c6b0c050bfcb9f2f067e7dc1b0242875254.tar.gz gitea-3cab9c6b0c050bfcb9f2f067e7dc1b0242875254.zip |
Add API to manage issue dependencies (#17935)
Adds API endpoints to manage issue/PR dependencies
* `GET /repos/{owner}/{repo}/issues/{index}/blocks` List issues that are
blocked by this issue
* `POST /repos/{owner}/{repo}/issues/{index}/blocks` Block the issue
given in the body by the issue in path
* `DELETE /repos/{owner}/{repo}/issues/{index}/blocks` Unblock the issue
given in the body by the issue in path
* `GET /repos/{owner}/{repo}/issues/{index}/dependencies` List an
issue's dependencies
* `POST /repos/{owner}/{repo}/issues/{index}/dependencies` Create a new
issue dependencies
* `DELETE /repos/{owner}/{repo}/issues/{index}/dependencies` Remove an
issue dependency
Closes https://github.com/go-gitea/gitea/issues/15393
Closes #22115
Co-authored-by: Andrew Thornton <art27@cantab.net>
Diffstat (limited to 'templates/repo')
-rw-r--r-- | templates/repo/issue/view_content/sidebar.tmpl | 39 |
1 files changed, 36 insertions, 3 deletions
diff --git a/templates/repo/issue/view_content/sidebar.tmpl b/templates/repo/issue/view_content/sidebar.tmpl index 0deb0a1891..25df29e5fb 100644 --- a/templates/repo/issue/view_content/sidebar.tmpl +++ b/templates/repo/issue/view_content/sidebar.tmpl @@ -420,7 +420,7 @@ <div class="ui divider"></div> <div class="ui depending"> - {{if (and (not .BlockedByDependencies) (not .BlockingDependencies))}} + {{if (and (not .BlockedByDependencies) (not .BlockedByDependenciesNotPermitted) (not .BlockingDependencies) (not .BlockingDependenciesNotPermitted))}} <span class="text"><strong>{{.locale.Tr "repo.issues.dependency.title"}}</strong></span> <br> <p> @@ -432,7 +432,7 @@ </p> {{end}} - {{if .BlockingDependencies}} + {{if or .BlockingDependencies .BlockingDependenciesNotPermitted}} <span class="text" data-tooltip-content="{{if .Issue.IsPull}}{{.locale.Tr "repo.issues.dependency.pr_close_blocks"}}{{else}}{{.locale.Tr "repo.issues.dependency.issue_close_blocks"}}{{end}}"> <strong>{{.locale.Tr "repo.issues.dependency.blocks_short"}}</strong> </span> @@ -456,10 +456,15 @@ </div> </div> {{end}} + {{if .BlockingDependenciesNotPermitted}} + <div class="item gt-df gt-ac gt-sb"> + <span>{{$.locale.TrN (len .BlockingDependenciesNotPermitted) "repo.issues.dependency.no_permission_1" "repo.issues.dependency.no_permission_n" (len .BlockingDependenciesNotPermitted)}}</span> + </div> + {{end}} </div> {{end}} - {{if .BlockedByDependencies}} + {{if or .BlockedByDependencies .BlockedByDependenciesNotPermitted}} <span class="text" data-tooltip-content="{{if .Issue.IsPull}}{{.locale.Tr "repo.issues.dependency.pr_closing_blockedby"}}{{else}}{{.locale.Tr "repo.issues.dependency.issue_closing_blockedby"}}{{end}}"> <strong>{{.locale.Tr "repo.issues.dependency.blocked_by_short"}}</strong> </span> @@ -483,6 +488,34 @@ </div> </div> {{end}} + {{if $.CanCreateIssueDependencies}} + {{range .BlockedByDependenciesNotPermitted}} + <div class="item dependency{{if .Issue.IsClosed}} is-closed{{end}} gt-df gt-ac gt-sb"> + <div class="item-left gt-df gt-jc gt-fc gt-f1"> + <div> + <span data-tooltip-content="{{$.locale.Tr "repo.issues.dependency.no_permission.can_remove"}}">{{svg "octicon-lock" 16}}</span> + <span class="title" data-tooltip-content="#{{.Issue.Index}} {{.Issue.Title | RenderEmoji $.Context}}"> + #{{.Issue.Index}} {{.Issue.Title | RenderEmoji $.Context}} + </span> + </div> + <div class="text small"> + {{.Repository.OwnerName}}/{{.Repository.Name}} + </div> + </div> + <div class="item-right gt-df gt-ac"> + {{if and $.CanCreateIssueDependencies (not $.Repository.IsArchived)}} + <a class="delete-dependency-button ci muted" data-id="{{.Issue.ID}}" data-type="blocking" data-tooltip-content="{{$.locale.Tr "repo.issues.dependency.remove_info"}}"> + {{svg "octicon-trash" 16}} + </a> + {{end}} + </div> + </div> + {{end}} + {{else if .BlockedByDependenciesNotPermitted}} + <div class="item gt-df gt-ac gt-sb"> + <span>{{$.locale.TrN (len .BlockedByDependenciesNotPermitted) "repo.issues.dependency.no_permission_1" "repo.issues.dependency.no_permission_n" (len .BlockedByDependenciesNotPermitted)}}</span> + </div> + {{end}} </div> {{end}} |