diff options
Diffstat (limited to 'lib/gitlab/search')
-rw-r--r-- | lib/gitlab/search/found_blob.rb | 5 | ||||
-rw-r--r-- | lib/gitlab/search/found_wiki_page.rb | 5 |
2 files changed, 8 insertions, 2 deletions
diff --git a/lib/gitlab/search/found_blob.rb b/lib/gitlab/search/found_blob.rb index 79d6cfc84a3..c9051b6a5ff 100644 --- a/lib/gitlab/search/found_blob.rb +++ b/lib/gitlab/search/found_blob.rb @@ -9,7 +9,7 @@ module Gitlab include Gitlab::Utils::StrongMemoize include BlobActiveModel - attr_reader :project, :content_match, :blob_path, :highlight_line, :matched_lines_count + attr_reader :project, :content_match, :blob_path, :highlight_line, :matched_lines_count, :group_level_blob, :group PATH_REGEXP = /\A(?<ref>[^:]*):(?<path>[^\x00]*)\x00/.freeze CONTENT_REGEXP = /^(?<ref>[^:]*):(?<path>[^\x00]*)\x00(?<startline>\d+)\x00/.freeze @@ -31,14 +31,17 @@ module Gitlab @binary_data = opts.fetch(:data, nil) @per_page = opts.fetch(:per_page, 20) @project = opts.fetch(:project, nil) + @group = opts.fetch(:group, nil) # Some callers (e.g. Elasticsearch) do not have the Project object, # yet they can trigger many calls in one go, # causing duplicated queries. # Allow those to just pass project_id instead. @project_id = opts.fetch(:project_id, nil) + @group_id = opts.fetch(:group_id, nil) @content_match = opts.fetch(:content_match, nil) @blob_path = opts.fetch(:blob_path, nil) @repository = opts.fetch(:repository, nil) + @group_level_blob = opts.fetch(:group_level_blob, false) end def id diff --git a/lib/gitlab/search/found_wiki_page.rb b/lib/gitlab/search/found_wiki_page.rb index 99ca6a79fe2..650bae2af4d 100644 --- a/lib/gitlab/search/found_wiki_page.rb +++ b/lib/gitlab/search/found_wiki_page.rb @@ -14,7 +14,8 @@ module Gitlab # @param found_blob [Gitlab::Search::FoundBlob] def initialize(found_blob) super - @wiki = found_blob.project.wiki + + @wiki ||= found_blob.project.wiki end def to_ability_name @@ -23,3 +24,5 @@ module Gitlab end end end + +Gitlab::Search::FoundWikiPage.prepend_mod_with('Gitlab::Search::FoundWikiPage') |