diff options
author | Oswaldo Ferreira <oswaldo@gitlab.com> | 2018-05-16 12:46:18 -0300 |
---|---|---|
committer | Oswaldo Ferreira <oswaldo@gitlab.com> | 2018-05-24 15:34:43 -0300 |
commit | bb8f2520b4254c9dabe377df48e29c5f17894a1d (patch) | |
tree | 59c0f074d6c662fd6243219e2cdfb205000e59f2 /app/models/merge_request_diff_file.rb | |
parent | ddc760a0d625706196629c061f9dfa1cd2d8402e (diff) | |
download | gitlab-ce-bb8f2520b4254c9dabe377df48e29c5f17894a1d.tar.gz |
Persist truncated note diffs on a new table45190-create-notes-diff-files
We request Gitaly in a N+1 manner to build discussion diffs. Once the diffs are from different revisions, it's hard to make a single request to the service in order to build the whole response.
With this change we solve this problem and simplify a lot fetching this piece of info.
Diffstat (limited to 'app/models/merge_request_diff_file.rb')
-rw-r--r-- | app/models/merge_request_diff_file.rb | 7 |
1 files changed, 1 insertions, 6 deletions
diff --git a/app/models/merge_request_diff_file.rb b/app/models/merge_request_diff_file.rb index 1199ff5af22..cd8ba6b904d 100644 --- a/app/models/merge_request_diff_file.rb +++ b/app/models/merge_request_diff_file.rb @@ -1,5 +1,6 @@ class MergeRequestDiffFile < ActiveRecord::Base include Gitlab::EncodingHelper + include DiffFile belongs_to :merge_request_diff @@ -12,10 +13,4 @@ class MergeRequestDiffFile < ActiveRecord::Base def diff binary? ? super.unpack('m0').first : super end - - def to_hash - keys = Gitlab::Git::Diff::SERIALIZE_KEYS - [:diff] - - as_json(only: keys).merge(diff: diff).with_indifferent_access - end end |