Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-03-03 03:08:11 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2020-03-03 03:08:11 +0300
commitbd8fb5668ae739a83d55ec5ca4a04344eef2167e (patch)
treebaf085c6cd58b3b5e5a192d4d3db360d623bb056 /app/serializers/diff_file_entity.rb
parent561e1b470f0a99fe6304c8f197348c47a637d594 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/serializers/diff_file_entity.rb')
-rw-r--r--app/serializers/diff_file_entity.rb14
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