diff options
author | zeripath <art27@cantab.net> | 2021-02-10 17:18:22 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-02-10 17:18:22 +0000 |
commit | 4cffc46f651205b9d7eb0b1df46dd6117c6d95e9 (patch) | |
tree | f82e20a5c9f6798481f6fc2623919052c993cbe5 /routers/repo/issue.go | |
parent | 0a23079485b8f40bc86f6869a202be8be2727cc6 (diff) | |
download | gitea-4cffc46f651205b9d7eb0b1df46dd6117c6d95e9.tar.gz gitea-4cffc46f651205b9d7eb0b1df46dd6117c6d95e9.zip |
Allow org labels to be set with issue templates (#14593)
Fix #13688
Signed-off-by: Andrew Thornton <art27@cantab.net>
Diffstat (limited to 'routers/repo/issue.go')
-rw-r--r-- | routers/repo/issue.go | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/routers/repo/issue.go b/routers/repo/issue.go index 1f57f2e9c8..71c8f1efbb 100644 --- a/routers/repo/issue.go +++ b/routers/repo/issue.go @@ -743,6 +743,14 @@ func setTemplateIfExists(ctx *context.Context, ctxDataKey string, possibleDirs [ ctx.Data[ctxDataKey] = templateBody labelIDs := make([]string, 0, len(meta.Labels)) if repoLabels, err := models.GetLabelsByRepoID(ctx.Repo.Repository.ID, "", models.ListOptions{}); err == nil { + ctx.Data["Labels"] = repoLabels + if ctx.Repo.Owner.IsOrganization() { + if orgLabels, err := models.GetLabelsByOrgID(ctx.Repo.Owner.ID, ctx.Query("sort"), models.ListOptions{}); err == nil { + ctx.Data["OrgLabels"] = orgLabels + repoLabels = append(repoLabels, orgLabels...) + } + } + for _, metaLabel := range meta.Labels { for _, repoLabel := range repoLabels { if strings.EqualFold(repoLabel.Name, metaLabel) { @@ -752,7 +760,6 @@ func setTemplateIfExists(ctx *context.Context, ctxDataKey string, possibleDirs [ } } } - ctx.Data["Labels"] = repoLabels } ctx.Data["HasSelectedLabel"] = len(labelIDs) > 0 ctx.Data["label_ids"] = strings.Join(labelIDs, ",") |