Commit 72273d3d authored by Oswaldo Ferreira's avatar Oswaldo Ferreira

Remove dead code on main MR page

parent e13a3c71
......@@ -44,12 +44,6 @@ class Projects::MergeRequestsController < Projects::MergeRequests::ApplicationCo
@noteable = @merge_request
@commits_count = @merge_request.commits_count
# TODO cleanup- Fatih Simon Create an issue to remove these after the refactoring
# we no longer render notes here. I see it will require a small frontend refactoring,
# since we gather some data from this collection.
@discussions = @merge_request.discussions
@notes = prepare_notes_for_rendering(@discussions.flat_map(&:notes), @noteable)
labels
set_pipeline_variables
......
......@@ -142,7 +142,7 @@ module NotesHelper
def initial_notes_data(autocomplete)
{
notesUrl: notes_url,
notesIds: @notes.map(&:id),
notesIds: @noteable.notes.pluck(:id), # rubocop: disable CodeReuse/ActiveRecord
now: Time.now.to_i,
diffView: diff_view,
enableGFM: {
......
---
title: Removes expensive dead code on main MR page request
merge_request: 22153
author:
type: performance
......@@ -76,28 +76,6 @@ describe Projects::MergeRequestsController do
expect(response).to be_success
end
context "loads notes" do
let(:first_contributor) { create(:user) }
let(:contributor) { create(:user) }
let(:merge_request) { create(:merge_request, author: first_contributor, target_project: project, source_project: project) }
let(:contributor_merge_request) { create(:merge_request, :merged, author: contributor, target_project: project, source_project: project) }
# the order here is important
# as the controller reloads these from DB, references doesn't correspond after
let!(:first_contributor_note) { create(:note, author: first_contributor, noteable: merge_request, project: project) }
let!(:contributor_note) { create(:note, author: contributor, noteable: merge_request, project: project) }
let!(:owner_note) { create(:note, author: user, noteable: merge_request, project: project) }
it "with special_role FIRST_TIME_CONTRIBUTOR" do
go(format: :html)
notes = assigns(:notes)
expect(notes).to match(a_collection_containing_exactly(an_object_having_attributes(special_role: Note::SpecialRole::FIRST_TIME_CONTRIBUTOR),
an_object_having_attributes(special_role: nil),
an_object_having_attributes(special_role: nil)
))
end
end
context "that is invalid" do
let(:merge_request) { create(:invalid_merge_request, target_project: project, source_project: 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