debian-mirror-gitlab/lib/api/entities/merge_request_changes.rb

32 lines
704 B
Ruby
Raw Normal View History

2020-03-13 15:44:24 +05:30
# frozen_string_literal: true
module API
module Entities
class MergeRequestChanges < MergeRequest
expose :diffs, as: :changes, using: Entities::Diff do |compare, _|
2021-01-29 00:20:46 +05:30
Array(diff_collection(compare))
end
expose :overflow?, as: :overflow
private
def overflow?
expose_raw_diffs? ? false : diff_collection(object).overflow?
end
def diff_collection(compare)
@diffs ||= if expose_raw_diffs?
compare.raw_diffs(limits: false)
else
compare.diffs.diffs
end
end
def expose_raw_diffs?
2022-06-21 17:19:12 +05:30
options[:access_raw_diffs]
2020-03-13 15:44:24 +05:30
end
end
end
end