Skip to content

Commit a1b74c5

Browse files
zeripathlunny
andauthored
Allow org labels to be set with issue templates (#14593) (#14647)
Backport #14593 Fix #13688 Signed-off-by: Andrew Thornton <[email protected]> Co-authored-by: Lunny Xiao <[email protected]>
1 parent 101fb0d commit a1b74c5

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
@@ -725,6 +725,14 @@ func setTemplateIfExists(ctx *context.Context, ctxDataKey string, possibleDirs [
725725
ctx.Data[ctxDataKey] = templateBody
726726
labelIDs := make([]string, 0, len(meta.Labels))
727727
if repoLabels, err := models.GetLabelsByRepoID(ctx.Repo.Repository.ID, "", models.ListOptions{}); err == nil {
728+
ctx.Data["Labels"] = repoLabels
729+
if ctx.Repo.Owner.IsOrganization() {
730+
if orgLabels, err := models.GetLabelsByOrgID(ctx.Repo.Owner.ID, ctx.Query("sort"), models.ListOptions{}); err == nil {
731+
ctx.Data["OrgLabels"] = orgLabels
732+
repoLabels = append(repoLabels, orgLabels...)
733+
}
734+
}
735+
728736
for _, metaLabel := range meta.Labels {
729737
for _, repoLabel := range repoLabels {
730738
if strings.EqualFold(repoLabel.Name, metaLabel) {
@@ -734,7 +742,6 @@ func setTemplateIfExists(ctx *context.Context, ctxDataKey string, possibleDirs [
734742
}
735743
}
736744
}
737-
ctx.Data["Labels"] = repoLabels
738745
}
739746
ctx.Data["HasSelectedLabel"] = len(labelIDs) > 0
740747
ctx.Data["label_ids"] = strings.Join(labelIDs, ",")

0 commit comments

Comments
 (0)