Class: Snippets::BaseService

Inherits:
BaseService show all
Includes:
SpamCheckMethods
Defined in:
app/services/snippets/base_service.rb

Direct Known Subclasses

CreateService, UpdateService

Constant Summary collapse

CreateRepositoryError =
Class.new(StandardError)

Instance Attribute Summary collapse

Attributes inherited from BaseService

#current_user, #params, #project

Instance Method Summary collapse

Methods included from SpamCheckMethods

#filter_spam_check_params, #spam_check

Methods included from BaseServiceUtility

#deny_visibility_level, #event_service, #log_error, #log_info, #notification_service, #system_hook_service, #todo_service, #visibility_level

Methods included from Gitlab::Allowable

#can?

Constructor Details

#initialize(project, user = nil, params = {}) ⇒ BaseService

Returns a new instance of BaseService.


11
12
13
14
15
16
17
18
19
20
# File 'app/services/snippets/base_service.rb', line 11

def initialize(project, user = nil, params = {})
  super

  @uploaded_assets = Array(@params.delete(:files).presence)

  input_actions = Array(@params.delete(:snippet_actions).presence)
  @snippet_actions = SnippetInputActionCollection.new(input_actions, allowed_actions: restricted_files_actions)

  filter_spam_check_params
end

Instance Attribute Details

#snippet_actionsObject (readonly)

Returns the value of attribute snippet_actions


9
10
11
# File 'app/services/snippets/base_service.rb', line 9

def snippet_actions
  @snippet_actions
end

#uploaded_assetsObject (readonly)

Returns the value of attribute uploaded_assets


9
10
11
# File 'app/services/snippets/base_service.rb', line 9

def uploaded_assets
  @uploaded_assets
end