diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-03-03 00:08:11 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-03-03 00:08:11 +0000 |
commit | bd8fb5668ae739a83d55ec5ca4a04344eef2167e (patch) | |
tree | baf085c6cd58b3b5e5a192d4d3db360d623bb056 /app | |
parent | 561e1b470f0a99fe6304c8f197348c47a637d594 (diff) | |
download | gitlab-ce-bd8fb5668ae739a83d55ec5ca4a04344eef2167e.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app')
-rw-r--r-- | app/serializers/diff_file_entity.rb | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/app/serializers/diff_file_entity.rb b/app/serializers/diff_file_entity.rb index af7d1172f17..c3826692c52 100644 --- a/app/serializers/diff_file_entity.rb +++ b/app/serializers/diff_file_entity.rb @@ -53,7 +53,7 @@ class DiffFileEntity < DiffFileBaseEntity end # Used for inline diffs - expose :highlighted_diff_lines, using: DiffLineEntity, if: -> (diff_file, options) { inline_diff_view?(options) && diff_file.text? } do |diff_file| + expose :highlighted_diff_lines, using: DiffLineEntity, if: -> (diff_file, options) { inline_diff_view?(options, diff_file) && diff_file.text? } do |diff_file| diff_file.diff_lines_for_serializer end @@ -62,19 +62,19 @@ class DiffFileEntity < DiffFileBaseEntity end # Used for parallel diffs - expose :parallel_diff_lines, using: DiffLineParallelEntity, if: -> (diff_file, options) { parallel_diff_view?(options) && diff_file.text? } + expose :parallel_diff_lines, using: DiffLineParallelEntity, if: -> (diff_file, options) { parallel_diff_view?(options, diff_file) && diff_file.text? } private - def parallel_diff_view?(options) - return true unless Feature.enabled?(:single_mr_diff_view) + def parallel_diff_view?(options, diff_file) + return true unless Feature.enabled?(:single_mr_diff_view, diff_file.repository.project) # If we're not rendering inline, we must be rendering parallel - !inline_diff_view?(options) + !inline_diff_view?(options, diff_file) end - def inline_diff_view?(options) - return true unless Feature.enabled?(:single_mr_diff_view) + def inline_diff_view?(options, diff_file) + return true unless Feature.enabled?(:single_mr_diff_view, diff_file.repository.project) # If nothing is present, inline will be the default. options.fetch(:diff_view, :inline).to_sym == :inline |