Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorToon Claes <toon@iotcl.com>2017-09-15 09:58:21 +0300
committerToon Claes <toon@iotcl.com>2017-12-13 23:26:01 +0300
commit2acf3a564c4d042b4cf5463867bd5d37723509f5 (patch)
tree76be3f9413422d7444f58b3750e10e0677d94ec7 /spec/models/note_spec.rb
parent43b98944fb34d1a3ca37ae598327e4575d2ec315 (diff)
Make mail notifications of discussion notes In-Reply-To of each other
When a note is part of a discussion, the email sent out should be `In-Reply-To` the previous note in that discussion. Closes gitlab-org/gitlab-ce#36054
Diffstat (limited to 'spec/models/note_spec.rb')
-rw-r--r--spec/models/note_spec.rb25
1 files changed, 25 insertions, 0 deletions
diff --git a/spec/models/note_spec.rb b/spec/models/note_spec.rb
index e1a0c55b6a6..cf79ecf00c2 100644
--- a/spec/models/note_spec.rb
+++ b/spec/models/note_spec.rb
@@ -756,6 +756,31 @@ describe Note do
end
end
+ describe '#replies_to' do
+ context 'when part of a discussion' do
+ let(:note) { create(:discussion_note_on_issue) }
+
+ it 'returns noteable when there are not earlier notes in the discussion' do
+ expect(note.replies_to).to eq(note.noteable)
+ end
+
+ it 'returns previous note in discussion' do
+ reply = create(:discussion_note_on_issue, in_reply_to: note)
+
+ expect(reply.replies_to).to eq(note)
+ end
+ end
+
+ context 'when not part of a discussion' do
+ subject { create(:note) }
+ let(:note) { create(:note, in_reply_to: subject) }
+
+ it 'returns the noteable' do
+ expect(note.replies_to).to eq(note.noteable)
+ end
+ end
+ end
+
describe 'expiring ETag cache' do
let(:note) { build(:note_on_issue) }