Class: Discussions::UnresolveService

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

Instance Attribute Summary

Attributes inherited from BaseService

#current_user, #params, #project

Instance Method Summary collapse

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?, #can_all?, #can_any?

Constructor Details

#initialize(discussion, user) ⇒ UnresolveService

Returns a new instance of UnresolveService.



7
8
9
10
11
12
# File 'app/services/discussions/unresolve_service.rb', line 7

def initialize(discussion, user)
  @discussion = discussion
  @user = user

  super
end

Instance Method Details

#executeObject



14
15
16
17
18
19
20
21
22
23
# File 'app/services/discussions/unresolve_service.rb', line 14

def execute
  @all_discussions_resolved_before = merge_request ? @discussion.noteable.discussions_resolved? : false

  @discussion.unresolve!

  send_graphql_triggers

  Gitlab::UsageDataCounters::MergeRequestActivityUniqueCounter
    .track_unresolve_thread_action(user: @user)
end