Commit 78ef6362 authored by Kerri Miller's avatar Kerri Miller

Extend diffs_metadata.json w/project & user names

parent a09aa50a
......@@ -18,8 +18,30 @@ class DiffsMetadataEntity < DiffsEntity
options[:merge_request].can_be_merged_by?(request.current_user)
end
expose :project_path
expose :project_name
expose :username
expose :user_full_name
private
def project_path
request.project&.full_path
end
def project_name
request.project&.name
end
def username
request.current_user&.username
end
def user_full_name
request.current_user&.name
end
def presenter(merge_request)
@presenters ||= {}
@presenters[merge_request] ||= MergeRequestPresenter.new(merge_request, current_user: request.current_user) # rubocop: disable CodeReuse/Presenter
......
---
title: Add additional fields to diff_metadata.json endpoint
merge_request: 50666
author:
type: changed
......@@ -31,6 +31,7 @@ RSpec.describe DiffsMetadataEntity do
:merge_request_diffs, :context_commits,
:definition_path_prefix, :source_branch_exists,
:can_merge, :conflict_resolution_path, :has_conflicts,
:project_name, :project_path, :user_full_name, :username,
# Attributes
:diff_files
)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment