Class: Search::GroupService

Inherits:
GlobalService show all
Defined in:
app/services/search/group_service.rb

Instance Attribute Summary collapse

Attributes inherited from GlobalService

#current_user, #params

Instance Method Summary collapse

Methods inherited from GlobalService

#allowed_scopes, #scope

Methods included from Gitlab::Utils::StrongMemoize

#clear_memoization, #strong_memoize, #strong_memoized?

Constructor Details

#initialize(user, group, params) ⇒ GroupService

Returns a new instance of GroupService.


7
8
9
10
11
# File 'app/services/search/group_service.rb', line 7

def initialize(user, group, params)
  super(user, params)

  @group = group
end

Instance Attribute Details

#groupObject

Returns the value of attribute group


5
6
7
# File 'app/services/search/group_service.rb', line 5

def group
  @group
end

Instance Method Details

#executeObject


13
14
15
16
17
18
19
20
21
# File 'app/services/search/group_service.rb', line 13

def execute
  Gitlab::GroupSearchResults.new(
    current_user,
    params[:search],
    projects,
    group: group,
    filters: { state: params[:state] }
  )
end

#projectsObject


23
24
25
26
27
28
# File 'app/services/search/group_service.rb', line 23

def projects
  return Project.none unless group
  return @projects if defined? @projects

  @projects = super.inside_path(group.full_path)
end