Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
78ef6362
Commit
78ef6362
authored
Dec 29, 2020
by
Kerri Miller
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Extend diffs_metadata.json w/project & user names
parent
a09aa50a
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
28 additions
and
0 deletions
+28
-0
app/serializers/diffs_metadata_entity.rb
app/serializers/diffs_metadata_entity.rb
+22
-0
changelogs/unreleased/291027-extend-diffs_metadata-with-project-and-user-names.yml
...027-extend-diffs_metadata-with-project-and-user-names.yml
+5
-0
spec/serializers/diffs_metadata_entity_spec.rb
spec/serializers/diffs_metadata_entity_spec.rb
+1
-0
No files found.
app/serializers/diffs_metadata_entity.rb
View file @
78ef6362
...
...
@@ -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
...
...
changelogs/unreleased/291027-extend-diffs_metadata-with-project-and-user-names.yml
0 → 100644
View file @
78ef6362
---
title
:
Add additional fields to diff_metadata.json endpoint
merge_request
:
50666
author
:
type
:
changed
spec/serializers/diffs_metadata_entity_spec.rb
View file @
78ef6362
...
...
@@ -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
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment