bb8f2520b4
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.
16 lines
309 B
Ruby
16 lines
309 B
Ruby
class MergeRequestDiffFile < ActiveRecord::Base
|
|
include Gitlab::EncodingHelper
|
|
include DiffFile
|
|
|
|
belongs_to :merge_request_diff
|
|
|
|
def utf8_diff
|
|
return '' if diff.blank?
|
|
|
|
encode_utf8(diff) if diff.respond_to?(:encoding)
|
|
end
|
|
|
|
def diff
|
|
binary? ? super.unpack('m0').first : super
|
|
end
|
|
end
|