diff --git a/options/locale/locale_en-US.ini b/options/locale/locale_en-US.ini index 7e2b6ad379..c672554c31 100644 --- a/options/locale/locale_en-US.ini +++ b/options/locale/locale_en-US.ini @@ -1685,9 +1685,9 @@ issues.dependency.issue_close_blocked = You need to close all issues blocking th issues.dependency.issue_batch_close_blocked = "Cannot batch close issues that you choose, because issue #%d still has open dependencies" issues.dependency.pr_close_blocked = You need to close all issues blocking this pull request before you can merge it. issues.dependency.blocks_short = Blocks -issues.dependency.blocks_following = blocks: %s +issues.dependency.blocks_following = blocks: issues.dependency.blocked_by_short = Depends on -issues.dependency.blocked_by_following = depends on: %s +issues.dependency.blocked_by_following = depends on: issues.dependency.remove_header = Remove Dependency issues.dependency.issue_remove_text = This will remove the dependency from this issue. Continue? issues.dependency.pr_remove_text = This will remove the dependency from this pull request. Continue? diff --git a/routers/web/repo/issue.go b/routers/web/repo/issue.go index 5e36661753..3925dcdc0a 100644 --- a/routers/web/repo/issue.go +++ b/routers/web/repo/issue.go @@ -43,6 +43,7 @@ import ( repo_module "code.gitea.io/gitea/modules/repository" "code.gitea.io/gitea/modules/setting" api "code.gitea.io/gitea/modules/structs" + "code.gitea.io/gitea/modules/templates" "code.gitea.io/gitea/modules/templates/vars" "code.gitea.io/gitea/modules/timeutil" "code.gitea.io/gitea/modules/util" @@ -140,27 +141,6 @@ func MustAllowPulls(ctx *context.Context) { } } -func dependenciesToHTML(ctx *context.Context, dependencies []*issues_model.DependencyInfo) template.HTML { - if len(dependencies) == 0 { - return "" - } - - htmlCode := "" - - for index, dependency := range dependencies { - if index != 0 { - htmlCode += `,` - } - anchorClasses := "gt-ml-2 ref-issue" - if dependency.Issue.IsClosed { - anchorClasses += " gt-line-through" - } - htmlCode += fmt.Sprintf(`#%d`, dependency.Issue.Link(), anchorClasses, dependency.Issue.Index) - } - - return template.HTML(htmlCode + "") -} - func issues(ctx *context.Context, milestoneID, projectID int64, isPullOption optional.Option[bool]) { var err error viewType := ctx.FormString("type") @@ -346,29 +326,20 @@ func issues(ctx *context.Context, milestoneID, projectID int64, isPullOption opt if unit, err := repo.GetUnit(ctx, unit.TypePullRequests); err == nil { if config := unit.PullRequestsConfig(); config.ShowDependencies { - blockingDependenciesTemplates := make(map[int64]template.HTML, len(issues)) - blockedByDependenciesTemplates := make(map[int64]template.HTML, len(issues)) - blockingDependenciesMap, err := issues.BlockingDependenciesMap(ctx) if err != nil { ctx.ServerError("BlockingDependenciesMap", err) return } - for i, blockingDependencies := range blockingDependenciesMap { - blockingDependenciesTemplates[i] = dependenciesToHTML(ctx, blockingDependencies) - } blockedByDependenciesMap, err := issues.BlockedByDependenciesMap(ctx) if err != nil { ctx.ServerError("BlockedByDependenciesMap", err) return } - for i, blockedByDependencies := range blockedByDependenciesMap { - blockedByDependenciesTemplates[i] = dependenciesToHTML(ctx, blockedByDependencies) - } - ctx.Data["BlockingDependenciesTemplates"] = blockingDependenciesTemplates - ctx.Data["BlockedByDependenciesTemplates"] = blockedByDependenciesTemplates + ctx.Data["BlockingDependenciesMap"] = blockingDependenciesMap + ctx.Data["BlockedByDependenciesMap"] = blockedByDependenciesMap } } diff --git a/templates/shared/issue_dependency.tmpl b/templates/shared/issue_dependency.tmpl index a1f4d14481..3eef63dd79 100644 --- a/templates/shared/issue_dependency.tmpl +++ b/templates/shared/issue_dependency.tmpl @@ -1,5 +1,9 @@ {{if .Dependencies}}