fix(labels): add org label for ls and pr (#1017)

Fix https://gitea.com/gitea/tea/issues/634, https://gitea.com/gitea/tea/issues/669

Reviewed-on: https://gitea.com/gitea/tea/pulls/1017
Reviewed-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: Minjie Fang <wingsallen@gmail.com>
Co-committed-by: Minjie Fang <wingsallen@gmail.com>
This commit is contained in:
Minjie Fang
2026-06-24 17:46:12 +00:00
committed by Lunny Xiao
parent 5cfee362c8
commit 88f5cdcafa
8 changed files with 371 additions and 13 deletions
+10
View File
@@ -23,6 +23,16 @@ func ResolveLabelNames(requestCtx stdctx.Context, client *gitea.Client, owner, r
if err != nil {
return nil, err
}
if _, _, err := client.Organizations.GetOrg(requestCtx, owner); err == nil {
orgLabels, _, err := client.Organizations.ListOrgLabels(requestCtx, owner, gitea.ListOrgLabelsOptions{
ListOptions: gitea.ListOptions{Page: page, PageSize: 50},
})
if err != nil {
return nil, err
}
labels = append(labels, orgLabels...)
}
for _, l := range labels {
if utils.Contains(labelNames, l.Name) {
labelIDs = append(labelIDs, l.ID)