diff options
author | jaqra <48099350+jaqra@users.noreply.github.com> | 2019-10-23 19:29:14 +0300 |
---|---|---|
committer | zeripath <art27@cantab.net> | 2019-10-23 17:29:14 +0100 |
commit | dbd9d8dd54fd3b0ff7b02ae7b7da8369654e3725 (patch) | |
tree | 972d334a1a6d98b8186c99511ad03234d32e6b8c /models/issue.go | |
parent | 637e3219ab477a554567ec2ecbf0050b61942a50 (diff) | |
download | gitea-dbd9d8dd54fd3b0ff7b02ae7b7da8369654e3725.tar.gz gitea-dbd9d8dd54fd3b0ff7b02ae7b7da8369654e3725.zip |
Add 'Alt + click' feature to exclude labels (#8199)
Add 'Alt + click' and 'Alt +enter' feature to exclude particular labels on searching for issues.
Diffstat (limited to 'models/issue.go')
-rw-r--r-- | models/issue.go | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/models/issue.go b/models/issue.go index 688a412d8c..f006917891 100644 --- a/models/issue.go +++ b/models/issue.go @@ -1248,8 +1248,12 @@ func (opts *IssuesOptions) setupSession(sess *xorm.Session) { if opts.LabelIDs != nil { for i, labelID := range opts.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)) + if labelID > 0 { + 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)) + } else { + sess.Where("issue.id not in (select issue_id from issue_label where label_id = ?)", -labelID) + } } } } |