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:
authorPaul Slaughter <pslaughter@gitlab.com>2018-09-24 00:15:29 +0300
committerPaul Slaughter <pslaughter@gitlab.com>2018-09-24 16:30:58 +0300
commit370f07361c6d0fb1565003ae9427f69ad6004009 (patch)
tree6427e055c38f72c753cada853f40a6879b431836 /spec/services/notes
parentce27f74afa4ff16eccf353b5ce1bf430c6eb64b3 (diff)
Auto resolve new notes of resolved discussions
**Why?** The previous behavior had resolved discussions being unresolved when commented on. This was strange UX, especially since there is a separate button for "Comment & unresolve discussion". https://gitlab.com/gitlab-org/gitlab-ce/issues/24128 **Note:** - Also adds changelog
Diffstat (limited to 'spec/services/notes')
-rw-r--r--spec/services/notes/build_service_spec.rb15
1 files changed, 15 insertions, 0 deletions
diff --git a/spec/services/notes/build_service_spec.rb b/spec/services/notes/build_service_spec.rb
index 6e1c1fe6c02..ff85c261cd4 100644
--- a/spec/services/notes/build_service_spec.rb
+++ b/spec/services/notes/build_service_spec.rb
@@ -4,6 +4,8 @@ describe Notes::BuildService do
let(:note) { create(:discussion_note_on_issue) }
let(:project) { note.project }
let(:author) { note.author }
+ let(:merge_request) { create(:merge_request, source_project: project) }
+ let(:mr_note) { create(:discussion_note_on_merge_request, noteable: merge_request, project: project, author: author) }
describe '#execute' do
context 'when in_reply_to_discussion_id is specified' do
@@ -12,6 +14,19 @@ describe Notes::BuildService do
new_note = described_class.new(project, author, note: 'Test', in_reply_to_discussion_id: note.discussion_id).execute
expect(new_note).to be_valid
expect(new_note.in_reply_to?(note)).to be_truthy
+ expect(new_note.resolved?).to be_falsey
+ end
+
+ context 'when discussion is resolved' do
+ before do
+ mr_note.resolve!(author)
+ end
+
+ it 'resolves the note' do
+ new_note = described_class.new(project, author, note: 'Test', in_reply_to_discussion_id: mr_note.discussion_id).execute
+ expect(new_note).to be_valid
+ expect(new_note.resolved?).to be_truthy
+ end
end
end