Commit dc0b27db authored by Sean McGivern's avatar Sean McGivern Committed by Timothy Andrew

Merge branch 'dm-fix-individual-notes-reply-attributes' into 'master'

Ensure replying to an individual note by email creates a note with its own discussion ID

Closes #31067

See merge request !10890
parent 5f1535fd
...@@ -10,4 +10,8 @@ class IndividualNoteDiscussion < Discussion ...@@ -10,4 +10,8 @@ class IndividualNoteDiscussion < Discussion
def individual_note? def individual_note?
true true
end end
def reply_attributes
super.tap { |attrs| attrs.delete(:discussion_id) }
end
end end
...@@ -15,8 +15,12 @@ class OutOfContextDiscussion < Discussion ...@@ -15,8 +15,12 @@ class OutOfContextDiscussion < Discussion
def self.override_discussion_id(note) def self.override_discussion_id(note)
discussion_id(note) discussion_id(note)
end end
def self.note_class def self.note_class
Note Note
end end
def reply_attributes
super.tap { |attrs| attrs.delete(:discussion_id) }
end
end end
---
title: Ensure replying to an individual note by email creates a note with its own
discussion ID
merge_request:
author:
...@@ -69,6 +69,7 @@ describe SentNotification, model: true do ...@@ -69,6 +69,7 @@ describe SentNotification, model: true do
it 'creates a comment on the issue' do it 'creates a comment on the issue' do
new_note = subject.create_reply('Test') new_note = subject.create_reply('Test')
expect(new_note.in_reply_to?(note)).to be_truthy expect(new_note.in_reply_to?(note)).to be_truthy
expect(new_note.discussion_id).not_to eq(note.discussion_id)
end end
end end
...@@ -79,6 +80,7 @@ describe SentNotification, model: true do ...@@ -79,6 +80,7 @@ describe SentNotification, model: true do
it 'creates a reply on the discussion' do it 'creates a reply on the discussion' do
new_note = subject.create_reply('Test') new_note = subject.create_reply('Test')
expect(new_note.in_reply_to?(note)).to be_truthy expect(new_note.in_reply_to?(note)).to be_truthy
expect(new_note.discussion_id).to eq(note.discussion_id)
end end
end end
...@@ -99,6 +101,7 @@ describe SentNotification, model: true do ...@@ -99,6 +101,7 @@ describe SentNotification, model: true do
it 'creates a comment on the merge request' do it 'creates a comment on the merge request' do
new_note = subject.create_reply('Test') new_note = subject.create_reply('Test')
expect(new_note.in_reply_to?(note)).to be_truthy expect(new_note.in_reply_to?(note)).to be_truthy
expect(new_note.discussion_id).not_to eq(note.discussion_id)
end end
end end
...@@ -109,6 +112,7 @@ describe SentNotification, model: true do ...@@ -109,6 +112,7 @@ describe SentNotification, model: true do
it 'creates a reply on the discussion' do it 'creates a reply on the discussion' do
new_note = subject.create_reply('Test') new_note = subject.create_reply('Test')
expect(new_note.in_reply_to?(note)).to be_truthy expect(new_note.in_reply_to?(note)).to be_truthy
expect(new_note.discussion_id).to eq(note.discussion_id)
end end
end end
...@@ -119,6 +123,7 @@ describe SentNotification, model: true do ...@@ -119,6 +123,7 @@ describe SentNotification, model: true do
it 'creates a reply on the discussion' do it 'creates a reply on the discussion' do
new_note = subject.create_reply('Test') new_note = subject.create_reply('Test')
expect(new_note.in_reply_to?(note)).to be_truthy expect(new_note.in_reply_to?(note)).to be_truthy
expect(new_note.discussion_id).to eq(note.discussion_id)
end end
end end
...@@ -140,6 +145,7 @@ describe SentNotification, model: true do ...@@ -140,6 +145,7 @@ describe SentNotification, model: true do
it 'creates a comment on the commit' do it 'creates a comment on the commit' do
new_note = subject.create_reply('Test') new_note = subject.create_reply('Test')
expect(new_note.in_reply_to?(note)).to be_truthy expect(new_note.in_reply_to?(note)).to be_truthy
expect(new_note.discussion_id).not_to eq(note.discussion_id)
end end
end end
...@@ -150,6 +156,7 @@ describe SentNotification, model: true do ...@@ -150,6 +156,7 @@ describe SentNotification, model: true do
it 'creates a reply on the discussion' do it 'creates a reply on the discussion' do
new_note = subject.create_reply('Test') new_note = subject.create_reply('Test')
expect(new_note.in_reply_to?(note)).to be_truthy expect(new_note.in_reply_to?(note)).to be_truthy
expect(new_note.discussion_id).to eq(note.discussion_id)
end end
end end
...@@ -160,6 +167,7 @@ describe SentNotification, model: true do ...@@ -160,6 +167,7 @@ describe SentNotification, model: true do
it 'creates a reply on the discussion' do it 'creates a reply on the discussion' do
new_note = subject.create_reply('Test') new_note = subject.create_reply('Test')
expect(new_note.in_reply_to?(note)).to be_truthy expect(new_note.in_reply_to?(note)).to be_truthy
expect(new_note.discussion_id).to eq(note.discussion_id)
end end
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