diff options
author | Jan Provaznik <jprovaznik@gitlab.com> | 2018-03-05 16:25:56 +0300 |
---|---|---|
committer | Sean McGivern <sean@mcgivern.me.uk> | 2018-03-05 16:25:56 +0300 |
commit | 741caf93e14758c223b6ef819390f5889bdd108b (patch) | |
tree | 3dcd6e8377b6688eed28e4a24a92cb4ba902ede6 /app/finders | |
parent | f56de375f756ffc4ba4aa76f0cada1a64c45d759 (diff) |
Use limited count queries also for scoped searches
Diffstat (limited to 'app/finders')
-rw-r--r-- | app/finders/notes_finder.rb | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/app/finders/notes_finder.rb b/app/finders/notes_finder.rb index 33ee1e975b9..35f4ff2f62f 100644 --- a/app/finders/notes_finder.rb +++ b/app/finders/notes_finder.rb @@ -48,11 +48,23 @@ class NotesFinder def init_collection if target notes_on_target + elsif target_type + notes_of_target_type else notes_of_any_type end end + def notes_of_target_type + notes = notes_for_type(target_type) + + search(notes) + end + + def target_type + @params[:target_type] + end + def notes_of_any_type types = %w(commit issue merge_request snippet) note_relations = types.map { |t| notes_for_type(t) } |