Skip to content

Commit 4cffc46

Browse files
authored
Allow org labels to be set with issue templates (#14593)
Fix #13688 Signed-off-by: Andrew Thornton <[email protected]>
1 parent 0a23079 commit 4cffc46

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

routers/repo/issue.go

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -743,6 +743,14 @@ func setTemplateIfExists(ctx *context.Context, ctxDataKey string, possibleDirs [
743743
ctx.Data[ctxDataKey] = templateBody
744744
labelIDs := make([]string, 0, len(meta.Labels))
745745
if repoLabels, err := models.GetLabelsByRepoID(ctx.Repo.Repository.ID, "", models.ListOptions{}); err == nil {
746+
ctx.Data["Labels"] = repoLabels
747+
if ctx.Repo.Owner.IsOrganization() {
748+
if orgLabels, err := models.GetLabelsByOrgID(ctx.Repo.Owner.ID, ctx.Query("sort"), models.ListOptions{}); err == nil {
749+
ctx.Data["OrgLabels"] = orgLabels
750+
repoLabels = append(repoLabels, orgLabels...)
751+
}
752+
}
753+
746754
for _, metaLabel := range meta.Labels {
747755
for _, repoLabel := range repoLabels {
748756
if strings.EqualFold(repoLabel.Name, metaLabel) {
@@ -752,7 +760,6 @@ func setTemplateIfExists(ctx *context.Context, ctxDataKey string, possibleDirs [
752760
}
753761
}
754762
}
755-
ctx.Data["Labels"] = repoLabels
756763
}
757764
ctx.Data["HasSelectedLabel"] = len(labelIDs) > 0
758765
ctx.Data["label_ids"] = strings.Join(labelIDs, ",")

0 commit comments

Comments
 (0)