Commit d1a661dd authored by Jan Provaznik's avatar Jan Provaznik

Merge branch '11445-fix-promoted-epic-inherited-discussions-ce' into 'master'

Port EE: Fix reply to discussion on promoted epic

See merge request gitlab-org/gitlab-ce!30411
parents a0c86c1f 435be144
......@@ -23,10 +23,14 @@ module Issuable
end
def rewrite_notes
new_discussion_ids = {}
original_entity.notes_with_associations.find_each do |note|
new_note = note.dup
new_discussion_ids[note.discussion_id] ||= Discussion.discussion_id(new_note)
new_params = {
project: new_entity.project, noteable: new_entity,
project: new_entity.project,
noteable: new_entity,
discussion_id: new_discussion_ids[note.discussion_id],
note: rewrite_content(new_note.note),
note_html: nil,
created_at: note.created_at,
......
......@@ -165,5 +165,18 @@ describe Issuable::Clone::ContentRewriter do
expect(note.note_html).not_to eq(new_note.note_html)
end
end
context "discussion notes" do
let(:note) { create(:note, noteable: original_issue, note: "sample note", project: project1) }
let!(:discussion) { create(:discussion_note_on_issue, in_reply_to: note, note: "reply to sample note") }
it 'rewrites discussion correctly' do
subject.execute
expect(new_issue.notes.count).to eq(original_issue.notes.count)
expect(new_issue.notes.where(discussion_id: discussion.discussion_id).count).to eq(0)
expect(original_issue.notes.where(discussion_id: discussion.discussion_id).count).to eq(1)
end
end
end
end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment