summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorSean McGivern <sean@gitlab.com>2017-11-03 13:49:37 +0000
committerSean McGivern <sean@gitlab.com>2017-11-03 14:28:18 +0000
commit9d259c2232a7a6bab344b961ef8dc9561c380c29 (patch)
treec47b47d24eb4f3a378c99824b35f3a4d20c3ceb7 /lib
parent8c01f3110c8d8601fc16b17850dfa778f1f3d877 (diff)
downloadgitlab-ce-9d259c2232a7a6bab344b961ef8dc9561c380c29.tar.gz
Add changes_count to the merge requests APIadd-changes-count-to-merge-requests-api
This returns the `real_size` of the MR's diff, which is a string indicating the number of changes. If the diff overflows after _n_ files, the string will be `$n+`.
Diffstat (limited to 'lib')
-rw-r--r--lib/api/entities.rb4
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/api/entities.rb b/lib/api/entities.rb
index 67cecb6a7ad..aeb6001cf46 100644
--- a/lib/api/entities.rb
+++ b/lib/api/entities.rb
@@ -478,6 +478,10 @@ module API
expose :subscribed do |merge_request, options|
merge_request.subscribed?(options[:current_user], options[:project])
end
+
+ expose :changes_count do |merge_request, _options|
+ merge_request.merge_request_diff.real_size
+ end
end
class MergeRequestChanges < MergeRequest