|
|
|
@ -88,6 +88,7 @@ func SearchIssues(ctx *context.APIContext) { |
|
|
|
|
opts.Private = true |
|
|
|
|
opts.AllLimited = true |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
issueCount := 0 |
|
|
|
|
for page := 1; ; page++ { |
|
|
|
|
opts.Page = page |
|
|
|
@ -127,15 +128,6 @@ func SearchIssues(ctx *context.APIContext) { |
|
|
|
|
issueIDs, err = issue_indexer.SearchIssuesByKeyword(repoIDs, keyword) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
labels := ctx.Query("labels") |
|
|
|
|
if splitted := strings.Split(labels, ","); labels != "" && len(splitted) > 0 { |
|
|
|
|
labelIDs, err = models.GetLabelIDsInReposByNames(repoIDs, splitted) |
|
|
|
|
if err != nil { |
|
|
|
|
ctx.Error(http.StatusInternalServerError, "GetLabelIDsInRepoByNames", err) |
|
|
|
|
return |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
var isPull util.OptionalBool |
|
|
|
|
switch ctx.Query("type") { |
|
|
|
|
case "pulls": |
|
|
|
@ -146,6 +138,12 @@ func SearchIssues(ctx *context.APIContext) { |
|
|
|
|
isPull = util.OptionalBoolNone |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
labels := strings.TrimSpace(ctx.Query("labels")) |
|
|
|
|
var includedLabelNames []string |
|
|
|
|
if len(labels) > 0 { |
|
|
|
|
includedLabelNames = strings.Split(labels, ",") |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// Only fetch the issues if we either don't have a keyword or the search returned issues
|
|
|
|
|
// This would otherwise return all issues if no issues were found by the search.
|
|
|
|
|
if len(keyword) == 0 || len(issueIDs) > 0 || len(labelIDs) > 0 { |
|
|
|
@ -157,7 +155,7 @@ func SearchIssues(ctx *context.APIContext) { |
|
|
|
|
RepoIDs: repoIDs, |
|
|
|
|
IsClosed: isClosed, |
|
|
|
|
IssueIDs: issueIDs, |
|
|
|
|
LabelIDs: labelIDs, |
|
|
|
|
IncludedLabelNames: includedLabelNames, |
|
|
|
|
SortType: "priorityrepo", |
|
|
|
|
PriorityRepoID: ctx.QueryInt64("priority_repo_id"), |
|
|
|
|
IsPull: isPull, |
|
|
|
|