Commit 8d7dc26d authored by Douwe Maan's avatar Douwe Maan

Support new diff notes on MRs with diff_refs

parent 2f30d004
......@@ -85,6 +85,7 @@ class Projects::MergeRequestsController < Projects::ApplicationController
noteable_id: @merge_request.id
}
@use_legacy_diff_notes = !@merge_request.support_new_diff_notes?
@grouped_diff_notes = @merge_request.notes.grouped_diff_notes
Banzai::NoteRenderer.render(
......
......@@ -11,6 +11,8 @@ class Deployment < ActiveRecord::Base
delegate :name, to: :environment, prefix: true
after_save :keep_around_commit
def commit
project.commit(sha)
end
......@@ -26,4 +28,8 @@ class Deployment < ActiveRecord::Base
def last?
self == environment.last_deployment
end
def keep_around_commit
project.repository.keep_around(self.sha)
end
end
......@@ -74,7 +74,7 @@ class DiffNote < Note
private
def supported?
!self.for_merge_request?
!self.for_merge_request? || self.noteable.support_new_diff_notes?
end
def set_original_position
......
......@@ -642,6 +642,10 @@ class MergeRequest < ActiveRecord::Base
merge_commit
end
def support_new_diff_notes?
diff_refs && diff_refs.complete?
end
def keep_around_commit
project.repository.keep_around(self.merge_commit_sha)
end
......
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