debian-mirror-gitlab/app/services/discussions/unresolve_service.rb

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

39 lines
900 B
Ruby
Raw Normal View History

2021-03-11 19:13:27 +05:30
# frozen_string_literal: true
module Discussions
class UnresolveService < Discussions::BaseService
include Gitlab::Utils::StrongMemoize
def initialize(discussion, user)
@discussion = discussion
@user = user
super
end
def execute
2023-03-17 16:20:25 +05:30
@all_discussions_resolved_before = merge_request ? @discussion.noteable.discussions_resolved? : false
2021-03-11 19:13:27 +05:30
@discussion.unresolve!
2023-03-17 16:20:25 +05:30
send_graphql_triggers
2021-03-11 19:13:27 +05:30
Gitlab::UsageDataCounters::MergeRequestActivityUniqueCounter
.track_unresolve_thread_action(user: @user)
end
2023-03-17 16:20:25 +05:30
private
def merge_request
@discussion.noteable if @discussion.for_merge_request?
end
strong_memoize_attr :merge_request
def send_graphql_triggers
return unless merge_request && @all_discussions_resolved_before
GraphqlTriggers.merge_request_merge_status_updated(merge_request)
end
2021-03-11 19:13:27 +05:30
end
end