|
|
@ -1210,7 +1210,7 @@ type IssuesOptions struct { |
|
|
|
PageSize int |
|
|
|
PageSize int |
|
|
|
IsClosed util.OptionalBool |
|
|
|
IsClosed util.OptionalBool |
|
|
|
IsPull util.OptionalBool |
|
|
|
IsPull util.OptionalBool |
|
|
|
Labels string |
|
|
|
LabelIDs []int64 |
|
|
|
SortType string |
|
|
|
SortType string |
|
|
|
IssueIDs []int64 |
|
|
|
IssueIDs []int64 |
|
|
|
} |
|
|
|
} |
|
|
@ -1289,15 +1289,10 @@ func (opts *IssuesOptions) setupSession(sess *xorm.Session) error { |
|
|
|
sess.And("issue.is_pull=?", false) |
|
|
|
sess.And("issue.is_pull=?", false) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if len(opts.Labels) > 0 && opts.Labels != "0" { |
|
|
|
if opts.LabelIDs != nil { |
|
|
|
labelIDs, err := base.StringsToInt64s(strings.Split(opts.Labels, ",")) |
|
|
|
for i, labelID := range opts.LabelIDs { |
|
|
|
if err != nil { |
|
|
|
sess.Join("INNER", fmt.Sprintf("issue_label il%d", i), |
|
|
|
return err |
|
|
|
fmt.Sprintf("issue.id = il%[1]d.issue_id AND il%[1]d.label_id = %[2]d", i, labelID)) |
|
|
|
} |
|
|
|
|
|
|
|
if len(labelIDs) > 0 { |
|
|
|
|
|
|
|
sess. |
|
|
|
|
|
|
|
Join("INNER", "issue_label", "issue.id = issue_label.issue_id"). |
|
|
|
|
|
|
|
In("issue_label.label_id", labelIDs) |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
return nil |
|
|
|
return nil |
|
|
@ -1475,9 +1470,11 @@ func GetIssueStats(opts *IssueStatsOptions) (*IssueStats, error) { |
|
|
|
labelIDs, err := base.StringsToInt64s(strings.Split(opts.Labels, ",")) |
|
|
|
labelIDs, err := base.StringsToInt64s(strings.Split(opts.Labels, ",")) |
|
|
|
if err != nil { |
|
|
|
if err != nil { |
|
|
|
log.Warn("Malformed Labels argument: %s", opts.Labels) |
|
|
|
log.Warn("Malformed Labels argument: %s", opts.Labels) |
|
|
|
} else if len(labelIDs) > 0 { |
|
|
|
} else { |
|
|
|
sess.Join("INNER", "issue_label", "issue.id = issue_label.issue_id"). |
|
|
|
for i, labelID := range labelIDs { |
|
|
|
In("issue_label.label_id", labelIDs) |
|
|
|
sess.Join("INNER", fmt.Sprintf("issue_label il%d", i), |
|
|
|
|
|
|
|
fmt.Sprintf("issue.id = il%[1]d.issue_id AND il%[1]d.label_id = %[2]d", i, labelID)) |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|