diff options
author | Earl Warren <earl-warren@noreply.codeberg.org> | 2024-12-30 09:26:15 +0100 |
---|---|---|
committer | Earl Warren <earl-warren@noreply.codeberg.org> | 2024-12-30 09:26:15 +0100 |
commit | 8d6f0d49c630510fd6245f9390d9a674e436cbf7 (patch) | |
tree | d53fdcccbfa1982925b4868b8b33e956d8d50520 /models | |
parent | Merge pull request 'feat: don't allow blocking the doer' (#6411) from gusted/... (diff) | |
parent | Improve Actions test (#32883) (followup) (diff) | |
download | forgejo-8d6f0d49c630510fd6245f9390d9a674e436cbf7.tar.xz forgejo-8d6f0d49c630510fd6245f9390d9a674e436cbf7.zip |
Merge pull request '[gitea] week 2024-53 cherry pick (gitea/main -> forgejo)' (#6391) from earl-warren/wcp/2024-53 into forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/6391
Reviewed-by: Gusted <gusted@noreply.codeberg.org>
Diffstat (limited to 'models')
-rw-r--r-- | models/fixtures/label.yml | 11 | ||||
-rw-r--r-- | models/issues/label.go | 11 |
2 files changed, 22 insertions, 0 deletions
diff --git a/models/fixtures/label.yml b/models/fixtures/label.yml index 2242b90dcd..acfac74968 100644 --- a/models/fixtures/label.yml +++ b/models/fixtures/label.yml @@ -96,3 +96,14 @@ num_issues: 0 num_closed_issues: 0 archived_unix: 0 + +- + id: 10 + repo_id: 3 + org_id: 0 + name: repo3label1 + color: '#112233' + exclusive: false + num_issues: 0 + num_closed_issues: 0 + archived_unix: 0 diff --git a/models/issues/label.go b/models/issues/label.go index 804a118e7a..259c87459e 100644 --- a/models/issues/label.go +++ b/models/issues/label.go @@ -353,6 +353,17 @@ func GetLabelIDsInRepoByNames(ctx context.Context, repoID int64, labelNames []st Find(&labelIDs) } +// GetLabelIDsInOrgByNames returns a list of labelIDs by names in a given org. +func GetLabelIDsInOrgByNames(ctx context.Context, orgID int64, labelNames []string) ([]int64, error) { + labelIDs := make([]int64, 0, len(labelNames)) + return labelIDs, db.GetEngine(ctx).Table("label"). + Where("org_id = ?", orgID). + In("name", labelNames). + Asc("name"). + Cols("id"). + Find(&labelIDs) +} + // BuildLabelNamesIssueIDsCondition returns a builder where get issue ids match label names func BuildLabelNamesIssueIDsCondition(labelNames []string) *builder.Builder { return builder.Select("issue_label.issue_id"). |