From 70626f324b53b0fc010cbbefcae7095201bf0f82 Mon Sep 17 00:00:00 2001 From: Patrick Bajao Date: Thu, 18 Jul 2019 20:09:35 +0800 Subject: Make diff_refs_match_commit validation reusable Move it to DiffPositionableNote concern which will be re-used in EE in DraftNote model. --- app/models/diff_note.rb | 7 ------- 1 file changed, 7 deletions(-) (limited to 'app/models/diff_note.rb') diff --git a/app/models/diff_note.rb b/app/models/diff_note.rb index f75c32633b1..861185dc222 100644 --- a/app/models/diff_note.rb +++ b/app/models/diff_note.rb @@ -20,7 +20,6 @@ class DiffNote < Note validates :noteable_type, inclusion: { in: -> (_note) { noteable_types } } validate :positions_complete validate :verify_supported - validate :diff_refs_match_commit, if: :for_commit? before_validation :set_line_code, if: :on_text? after_save :keep_around_commits @@ -154,12 +153,6 @@ class DiffNote < Note errors.add(:position, "is invalid") end - def diff_refs_match_commit - return if self.original_position.diff_refs == self.commit.diff_refs - - errors.add(:commit_id, 'does not match the diff refs') - end - def keep_around_commits shas = [ self.original_position.base_sha, -- cgit v1.2.1