Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
6083ee41
Commit
6083ee41
authored
Mar 13, 2019
by
GitLab Bot
Browse files
Options
Browse Files
Download
Plain Diff
Automatic merge of gitlab-org/gitlab-ce master
parents
426840c3
69ed9ae4
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
23 additions
and
1 deletion
+23
-1
app/models/label.rb
app/models/label.rb
+7
-0
changelogs/unreleased/allow-filtering-labels-by-a-single-character.yml
...released/allow-filtering-labels-by-a-single-character.yml
+5
-0
lib/gitlab/sql/pattern.rb
lib/gitlab/sql/pattern.rb
+5
-1
spec/finders/labels_finder_spec.rb
spec/finders/labels_finder_spec.rb
+6
-0
No files found.
app/models/label.rb
View file @
6083ee41
...
...
@@ -126,6 +126,13 @@ class Label < ActiveRecord::Base
fuzzy_search
(
query
,
[
:title
,
:description
])
end
# Override Gitlab::SQL::Pattern.min_chars_for_partial_matching as
# label queries are never global, and so will not use a trigram
# index. That means we can have just one character in the LIKE.
def
self
.
min_chars_for_partial_matching
1
end
def
open_issues_count
(
user
=
nil
)
issues_count
(
user
,
state:
'opened'
)
end
...
...
changelogs/unreleased/allow-filtering-labels-by-a-single-character.yml
0 → 100644
View file @
6083ee41
---
title
:
Allow filtering labels list by one or two characters
merge_request
:
26012
author
:
type
:
changed
lib/gitlab/sql/pattern.rb
View file @
6083ee41
...
...
@@ -23,8 +23,12 @@ module Gitlab
end
end
def
min_chars_for_partial_matching
MIN_CHARS_FOR_PARTIAL_MATCHING
end
def
partial_matching?
(
query
)
query
.
length
>=
MIN_CHARS_FOR_PARTIAL_MATCHING
query
.
length
>=
min_chars_for_partial_matching
end
# column - The column name to search in.
...
...
spec/finders/labels_finder_spec.rb
View file @
6083ee41
...
...
@@ -209,6 +209,12 @@ describe LabelsFinder do
expect
(
finder
.
execute
).
to
eq
[
project_label_1
]
end
it
'returns labels matching a single character'
do
finder
=
described_class
.
new
(
user
,
search:
'('
)
expect
(
finder
.
execute
).
to
eq
[
group_label_1
]
end
end
context
'filter by subscription'
do
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment