Class: Discussions::ResolveService

Inherits:
BaseService show all
Includes:
Gitlab::Utils::StrongMemoize
Defined in:
app/services/discussions/resolve_service.rb

Instance Attribute Summary

Attributes inherited from BaseService

#current_user, #params, #project

Instance Method Summary collapse

Methods included from Gitlab::Utils::StrongMemoize

#clear_memoization, #strong_memoize, #strong_memoized?

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 = {}) ⇒ ResolveService

Returns a new instance of ResolveService.

Raises:

  • (ArgumentError)

7
8
9
10
11
12
13
14
15
16
# File 'app/services/discussions/resolve_service.rb', line 7

def initialize(project, user = nil, params = {})
  @discussions = Array.wrap(params.fetch(:one_or_more_discussions))
  @follow_up_issue = params[:follow_up_issue]
  @resolved_count = 0

  raise ArgumentError, 'Discussions must be all for the same noteable' \
    unless noteable_is_same?

  super
end

Instance Method Details

#executeObject


18
19
20
21
# File 'app/services/discussions/resolve_service.rb', line 18

def execute
  discussions.each(&method(:resolve_discussion))
  process_auto_merge
end