summaryrefslogtreecommitdiff
path: root/app/serializers/diff_file_entity.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/serializers/diff_file_entity.rb')
-rw-r--r--app/serializers/diff_file_entity.rb6
1 files changed, 5 insertions, 1 deletions
diff --git a/app/serializers/diff_file_entity.rb b/app/serializers/diff_file_entity.rb
index cbe6f200b86..63ea8e8f95f 100644
--- a/app/serializers/diff_file_entity.rb
+++ b/app/serializers/diff_file_entity.rb
@@ -84,7 +84,7 @@ class DiffFileEntity < Grape::Entity
end
expose :old_path_html do |diff_file|
- old_path = mark_inline_diffs(diff_file.old_path, diff_file.new_path)
+ old_path, _ = mark_inline_diffs(diff_file.old_path, diff_file.new_path)
old_path
end
@@ -116,6 +116,10 @@ class DiffFileEntity < Grape::Entity
project_blob_path(project, tree_join(diff_file.content_sha, diff_file.new_path))
end
+ expose :viewer, using: DiffViewerEntity do |diff_file|
+ diff_file.rich_viewer || diff_file.simple_viewer
+ end
+
expose :replaced_view_path, if: -> (_, options) { options[:merge_request] } do |diff_file|
image_diff = diff_file.rich_viewer && diff_file.rich_viewer.partial_name == 'image'
image_replaced = diff_file.old_content_sha && diff_file.old_content_sha != diff_file.content_sha