diff options
author | Oswaldo Ferreira <oswaldo@gitlab.com> | 2019-02-20 18:20:08 -0300 |
---|---|---|
committer | Oswaldo Ferreira <oswaldo@gitlab.com> | 2019-02-26 17:19:17 -0300 |
commit | e116fcab4151d61087afae17b6bf6cac58be29fc (patch) | |
tree | f641fd7f6fa036f93bcf171ffae370d29e57c5d7 /app/models/diff_note.rb | |
parent | 3395eacb57285424b7b8d49bdf836f638af31e8c (diff) | |
download | gitlab-ce-e116fcab4151d61087afae17b6bf6cac58be29fc.tar.gz |
Always fetch MR latest version when creating suggestions
This is an issue that can only be seen through EE. Further
details can be seen on
https://gitlab.com/gitlab-org/gitlab-ee/issues/9876. In general
we should always use the latest diff version of a file in order
to both create and apply suggestions.
Diffstat (limited to 'app/models/diff_note.rb')
-rw-r--r-- | app/models/diff_note.rb | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/app/models/diff_note.rb b/app/models/diff_note.rb index 279603496b0..bd9e146a40f 100644 --- a/app/models/diff_note.rb +++ b/app/models/diff_note.rb @@ -41,6 +41,15 @@ class DiffNote < Note create_note_diff_file(creation_params) end + # Returns the diff file from `position` + def latest_diff_file + strong_memoize(:latest_diff_file) do + repository = project.repository + position.diff_file(repository) + end + end + + # Returns the diff file from `original_position` def diff_file strong_memoize(:diff_file) do enqueue_diff_file_creation_job if should_create_diff_file? |