summaryrefslogtreecommitdiff
path: root/app/serializers/diffs_entity.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/serializers/diffs_entity.rb')
-rw-r--r--app/serializers/diffs_entity.rb9
1 files changed, 9 insertions, 0 deletions
diff --git a/app/serializers/diffs_entity.rb b/app/serializers/diffs_entity.rb
index 4bc6644a5cb..64f7f8bb5eb 100644
--- a/app/serializers/diffs_entity.rb
+++ b/app/serializers/diffs_entity.rb
@@ -84,6 +84,15 @@ class DiffsEntity < Grape::Entity
project_blob_path(merge_request.project, merge_request.diff_head_sha)
end
+ expose :context_commits_diff, if: -> (_) { merge_request&.project&.context_commits_enabled? } do |diffs, options|
+ next unless merge_request.context_commits_diff.commits_count > 0
+
+ ContextCommitsDiffEntity.represent(
+ merge_request.context_commits_diff,
+ options
+ )
+ end
+
def merge_request
options[:merge_request]
end