Commit dcec4c53 authored by Bob Van Landuyt's avatar Bob Van Landuyt

Finding discussions in NotesFinder is no longer required.

Since the MergeRequest is now a required param for resolving discussions
parent b9aa6c35
...@@ -11,7 +11,6 @@ class NotesFinder ...@@ -11,7 +11,6 @@ class NotesFinder
# target_type: string # target_type: string
# target_id: integer # target_id: integer
# last_fetched_at: time # last_fetched_at: time
# discussion_id: string
# search: string # search: string
# #
def initialize(project, current_user, params = {}) def initialize(project, current_user, params = {})
...@@ -23,7 +22,6 @@ class NotesFinder ...@@ -23,7 +22,6 @@ class NotesFinder
def execute def execute
@notes = since_fetch_at(@params[:last_fetched_at]) if @params[:last_fetched_at] @notes = since_fetch_at(@params[:last_fetched_at]) if @params[:last_fetched_at]
@notes = for_discussion(@params[:discussion_id]) if @params[:discussion_id]
@notes @notes
end end
...@@ -102,8 +100,4 @@ class NotesFinder ...@@ -102,8 +100,4 @@ class NotesFinder
@notes.where('updated_at > ?', last_fetched_at - FETCH_OVERLAP).fresh @notes.where('updated_at > ?', last_fetched_at - FETCH_OVERLAP).fresh
end end
def for_discussion(discussion_id)
@notes.where(discussion_id: discussion_id)
end
end end
...@@ -41,17 +41,6 @@ describe NotesFinder do ...@@ -41,17 +41,6 @@ describe NotesFinder do
expect(notes.count).to eq(0) expect(notes.count).to eq(0)
end end
context 'for a certain discussion' do
let!(:note_in_a_commit_discussion) { create(:note_on_commit, project: project) }
let!(:other_note) { create(:note_on_merge_request, project: project) }
it 'finds the only the notes for a certain discussion id' do
notes = described_class.new(project, user, discussion_id: note_in_a_commit_discussion.discussion_id).execute
expect(notes).to contain_exactly(note_in_a_commit_discussion)
end
end
context 'on restricted projects' do context 'on restricted projects' do
let(:project) do let(:project) do
create(:empty_project, create(:empty_project,
......
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