mirror of
https://github.com/go-gitea/gitea.git
synced 2025-03-14 07:16:09 +08:00
enhancement: Show blocked_by and blocking in issue-list-view
This commit is contained in:
parent
930bae2300
commit
aa061b409f
@ -324,6 +324,8 @@ func issues(ctx *context.Context, milestoneID, projectID int64, isPullOption opt
|
||||
return
|
||||
}
|
||||
|
||||
blockingDependenciesMap := make(map[int64][]*issues_model.DependencyInfo, len(issues))
|
||||
blockedByDependenciesMap := make(map[int64][]*issues_model.DependencyInfo, len(issues))
|
||||
// Get posters.
|
||||
for i := range issues {
|
||||
// Check read status
|
||||
@ -333,7 +335,24 @@ func issues(ctx *context.Context, milestoneID, projectID int64, isPullOption opt
|
||||
ctx.ServerError("GetIsRead", err)
|
||||
return
|
||||
}
|
||||
blockingDependencies, err := issues[i].BlockingDependencies(ctx)
|
||||
if err != nil {
|
||||
ctx.ServerError("BlockingDependencies", err)
|
||||
return
|
||||
}
|
||||
slices.Reverse(blockingDependencies)
|
||||
blockingDependenciesMap[issues[i].ID] = blockingDependencies
|
||||
|
||||
blockedByDependencies, err := issues[i].BlockedByDependencies(ctx, db.ListOptions{})
|
||||
if err != nil {
|
||||
ctx.ServerError("BlockedByDependencies", err)
|
||||
return
|
||||
}
|
||||
slices.Reverse(blockedByDependencies)
|
||||
blockedByDependenciesMap[issues[i].ID] = blockedByDependencies
|
||||
}
|
||||
ctx.Data["BlockingDependenciesMap"] = blockingDependenciesMap
|
||||
ctx.Data["BlockedByDependenciesMap"] = blockedByDependenciesMap
|
||||
|
||||
commitStatuses, lastStatus, err := pull_service.GetIssuesAllCommitStatus(ctx, issues)
|
||||
if err != nil {
|
||||
|
@ -118,6 +118,32 @@
|
||||
</span>
|
||||
</span>
|
||||
{{end}}
|
||||
{{if and $.BlockingDependenciesMap (index $.BlockingDependenciesMap .ID)}}
|
||||
<div class="flex-text-inline gt-gap-0">
|
||||
<strong class="gt-mr-2">{{ctx.Locale.Tr "repo.issues.dependency.blocks_short"}}:</strong>
|
||||
{{ $first := true }}
|
||||
{{range (index $.BlockingDependenciesMap .ID)}}
|
||||
{{if not $first}}<span class="gt-mr-2">, </span>{{end}}
|
||||
{{ $first = false }}
|
||||
<a href="{{.Issue.Link}}" data-tooltip-content="#{{.Issue.Index}} {{.Issue.Title | RenderEmoji $.Context}}">
|
||||
#{{.Issue.Index}}
|
||||
</a>
|
||||
{{end}}
|
||||
</div>
|
||||
{{end}}
|
||||
{{if and $.BlockedByDependenciesMap (index $.BlockedByDependenciesMap .ID)}}
|
||||
<div class="flex-text-inline gt-gap-0">
|
||||
<strong class="gt-mr-2">{{ctx.Locale.Tr "repo.issues.dependency.blocked_by_short"}}:</strong>
|
||||
{{ $first := true }}
|
||||
{{range (index $.BlockedByDependenciesMap .ID)}}
|
||||
{{if not $first}}<span class="gt-mr-2">, </span>{{end}}
|
||||
{{ $first = false }}
|
||||
<a href="{{.Issue.Link}}" data-tooltip-content="#{{.Issue.Index}} {{.Issue.Title | RenderEmoji $.Context}}">
|
||||
#{{.Issue.Index}}
|
||||
</a>
|
||||
{{end}}
|
||||
</div>
|
||||
{{end}}
|
||||
{{if .IsPull}}
|
||||
{{$approveOfficial := call $approvalCounts .ID "approve"}}
|
||||
{{$rejectOfficial := call $approvalCounts .ID "reject"}}
|
||||
|
Loading…
x
Reference in New Issue
Block a user