From 99ba5d0d5097e3170747d17261bb3b9f60aa49fb Mon Sep 17 00:00:00 2001 From: Douwe Maan Date: Thu, 17 Aug 2017 18:55:04 +0200 Subject: [PATCH] Remove view=full_data from NotesController --- .../javascripts/notes/components/issue_comment_form.vue | 1 - .../javascripts/notes/components/issue_discussion.vue | 1 - app/assets/javascripts/notes/components/issue_note.vue | 1 - app/controllers/concerns/notes_actions.rb | 8 ++------ app/views/projects/issues/_discussion.html.haml | 2 +- spec/helpers/notes_helper_spec.rb | 8 -------- spec/javascripts/notes/mock_data.js | 4 ++-- 7 files changed, 5 insertions(+), 20 deletions(-) diff --git a/app/assets/javascripts/notes/components/issue_comment_form.vue b/app/assets/javascripts/notes/components/issue_comment_form.vue index 4415c05a154..d80fc4bd373 100644 --- a/app/assets/javascripts/notes/components/issue_comment_form.vue +++ b/app/assets/javascripts/notes/components/issue_comment_form.vue @@ -110,7 +110,6 @@ endpoint: this.endpoint, flashContainer: this.$el, data: { - view: 'full_data', note: { noteable_type: constants.NOTEABLE_TYPE, noteable_id: this.getIssueData.id, diff --git a/app/assets/javascripts/notes/components/issue_discussion.vue b/app/assets/javascripts/notes/components/issue_discussion.vue index 7fd6be12261..1bec06ea969 100644 --- a/app/assets/javascripts/notes/components/issue_discussion.vue +++ b/app/assets/javascripts/notes/components/issue_discussion.vue @@ -100,7 +100,6 @@ target_type: 'issue', target_id: this.discussion.noteable_id, note: { note: noteText }, - view: 'full_data', }, }; diff --git a/app/assets/javascripts/notes/components/issue_note.vue b/app/assets/javascripts/notes/components/issue_note.vue index c44f735d5e7..600142a6866 100644 --- a/app/assets/javascripts/notes/components/issue_note.vue +++ b/app/assets/javascripts/notes/components/issue_note.vue @@ -77,7 +77,6 @@ const data = { endpoint: this.note.path, note: { - view: 'full_data', target_type: 'issue', target_id: this.note.noteable_id, note: { note: noteText }, diff --git a/app/controllers/concerns/notes_actions.rb b/app/controllers/concerns/notes_actions.rb index 1809464f4f4..29142e70ed8 100644 --- a/app/controllers/concerns/notes_actions.rb +++ b/app/controllers/concerns/notes_actions.rb @@ -18,8 +18,7 @@ module NotesActions @notes = prepare_notes_for_rendering(@notes) notes_json[:notes] = - case params[:view] - when 'full_data' + if noteable.is_a?(Issue) note_serializer.represent(@notes) else @notes.map { |note| note_json(note) } @@ -88,8 +87,7 @@ module NotesActions if note.persisted? attrs[:valid] = true - case params[:view] - when 'full_data' + if noteable.is_a?(Issue) attrs.merge!(note_serializer.represent(note)) else attrs.merge!( @@ -179,8 +177,6 @@ module NotesActions end def set_polling_interval_header - return unless noteable.is_a?(Issue) - Gitlab::PollingInterval.set_header(response, interval: 6_000) end diff --git a/app/views/projects/issues/_discussion.html.haml b/app/views/projects/issues/_discussion.html.haml index f2992a7c687..50aae5388e9 100644 --- a/app/views/projects/issues/_discussion.html.haml +++ b/app/views/projects/issues/_discussion.html.haml @@ -10,7 +10,7 @@ new_session_path: new_session_path(:user, redirect_to_referer: 'yes'), markdown_docs: help_page_path('user/markdown'), quick_actions_docs: help_page_path('user/project/quick_actions'), - notes_path: notes_url(view: 'full_data'), + notes_path: notes_url, last_fetched_at: Time.now.to_i, issue_data: serialize_issuable(@issue), current_user_data: UserSerializer.new.represent(current_user).to_json } } diff --git a/spec/helpers/notes_helper_spec.rb b/spec/helpers/notes_helper_spec.rb index 41474c32755..9921ca1af33 100644 --- a/spec/helpers/notes_helper_spec.rb +++ b/spec/helpers/notes_helper_spec.rb @@ -205,14 +205,6 @@ describe NotesHelper do expect(helper.notes_url).to eq("/nm/test/noteable/issue/#{@noteable.id}/notes") end - - it 'adds extra params' do - namespace = create(:namespace, path: 'nm') - @project = create(:project, path: 'test', namespace: namespace) - @noteable = create(:issue, project: @project) - - expect(helper.notes_url(view: 'full_data')).to eq("/nm/test/noteable/issue/#{@noteable.id}/notes?view=full_data") - end end describe '#note_url' do diff --git a/spec/javascripts/notes/mock_data.js b/spec/javascripts/notes/mock_data.js index 968188c1cf5..54048cc68f2 100644 --- a/spec/javascripts/notes/mock_data.js +++ b/spec/javascripts/notes/mock_data.js @@ -4,7 +4,7 @@ export const notesDataMock = { lastFetchedAt: '1501862675', markdownDocs: '/help/user/markdown', newSessionPath: '/users/sign_in?redirect_to_referer=yes', - notesPath: '/gitlab-org/gitlab-ce/noteable/issue/98/notes?view=full_data', + notesPath: '/gitlab-org/gitlab-ce/noteable/issue/98/notes', quickActionsDocs: '/help/user/project/quick_actions', registerPath: '/users/sign_in?redirect_to_referer=yes#register-pane', }; @@ -446,4 +446,4 @@ export const discussionNoteServerResponse = [{ "path": "/gitlab-org/gitlab-ce/notes/1471" }], "individual_note": false -}]; \ No newline at end of file +}]; -- GitLab