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