No need to look up the notable separately in the ResolveService

The merge request will now always be there when the discussion was
resolved by creating a new issue.
This commit is contained in:
Bob Van Landuyt 2017-03-07 23:49:16 +01:00
parent dcec4c531f
commit 224c2addde
2 changed files with 2 additions and 8 deletions

View file

@ -9,13 +9,7 @@ module Discussions
discussion.resolve!(current_user) discussion.resolve!(current_user)
notify_discussion_resolved(discussion) MergeRequests::ResolvedDiscussionNotificationService.new(project, current_user).execute(merge_request)
end
def notify_discussion_resolved(discussion)
noteable = merge_request || discussion.noteable
MergeRequests::ResolvedDiscussionNotificationService.new(project, current_user).execute(noteable)
SystemNoteService.discussion_continued_in_issue(discussion, project, current_user, follow_up_issue) if follow_up_issue SystemNoteService.discussion_continued_in_issue(discussion, project, current_user, follow_up_issue) if follow_up_issue
end end

View file

@ -6,7 +6,7 @@ describe Discussions::ResolveService do
let(:project) { merge_request.project } let(:project) { merge_request.project }
let(:merge_request) { discussion.noteable } let(:merge_request) { discussion.noteable }
let(:user) { create(:user) } let(:user) { create(:user) }
let(:service) { described_class.new(discussion.noteable.project, user) } let(:service) { described_class.new(discussion.noteable.project, user, merge_request: merge_request) }
before do before do
project.team << [user, :master] project.team << [user, :master]