diff options
author | Oswaldo Ferreira <oswaldo@gitlab.com> | 2018-06-11 17:45:16 -0300 |
---|---|---|
committer | Oswaldo Ferreira <oswaldo@gitlab.com> | 2018-06-24 18:01:37 -0300 |
commit | f5ed18e1e3b5e69fa7bd650f3144fcfe26ac315f (patch) | |
tree | 8405dff7d899d03a39f68cce3e7968c8990ac2e4 /app/models/merge_request.rb | |
parent | 2bac2918b2d6f12d94f739f4b6865b9e9221c642 (diff) | |
download | gitlab-ce-f5ed18e1e3b5e69fa7bd650f3144fcfe26ac315f.tar.gz |
Delete non-latest merge request diff files upon diffs reloadosw-delete-non-latest-mr-diff-files-upon-merge
Diffstat (limited to 'app/models/merge_request.rb')
-rw-r--r-- | app/models/merge_request.rb | 17 |
1 files changed, 5 insertions, 12 deletions
diff --git a/app/models/merge_request.rb b/app/models/merge_request.rb index 3df1130a6e2..f112c06e26f 100644 --- a/app/models/merge_request.rb +++ b/app/models/merge_request.rb @@ -378,6 +378,10 @@ class MergeRequest < ActiveRecord::Base end end + def non_latest_diffs + merge_request_diffs.where.not(id: merge_request_diff.id) + end + def diff_size # Calling `merge_request_diff.diffs.real_size` will also perform # highlighting, which we don't need here. @@ -619,18 +623,7 @@ class MergeRequest < ActiveRecord::Base def reload_diff(current_user = nil) return unless open? - old_diff_refs = self.diff_refs - new_diff = create_merge_request_diff - - MergeRequests::MergeRequestDiffCacheService.new.execute(self, new_diff) - - new_diff_refs = self.diff_refs - - update_diff_discussion_positions( - old_diff_refs: old_diff_refs, - new_diff_refs: new_diff_refs, - current_user: current_user - ) + MergeRequests::ReloadDiffsService.new(self, current_user).execute end def check_if_can_be_merged |