blob: 89105dceb5f039c4693fcc12ed43af2a0963b3ef (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
module Issues
module ResolveDiscussions
attr_reader :merge_request_for_resolving_discussions_iid, :discussion_to_resolve_id
def filter_resolve_discussion_params
@merge_request_for_resolving_discussions_iid ||= params.delete(:merge_request_for_resolving_discussions)
@discussion_to_resolve_id ||= params.delete(:discussion_to_resolve)
end
def merge_request_for_resolving_discussions
return @merge_request_for_resolving_discussions if defined?(@merge_request_for_resolving_discussions)
@merge_request_for_resolving_discussions = MergeRequestsFinder.new(current_user, project_id: project.id).
execute.
find_by(iid: merge_request_for_resolving_discussions_iid)
end
def discussions_to_resolve
return [] unless merge_request_for_resolving_discussions
@discussions_to_resolve ||=
if discussion_to_resolve_id
discussion_or_nil = merge_request_for_resolving_discussions
.find_diff_discussion(discussion_to_resolve_id)
Array(discussion_or_nil)
else
merge_request_for_resolving_discussions
.resolvable_discussions
end
end
end
end
|