From b9e52612feb4956f0b3cc26af0f98810e67a5287 Mon Sep 17 00:00:00 2001 From: Tim Zallmann Date: Tue, 9 Jul 2019 08:44:19 +0000 Subject: Updates on success of an MR the count on top and in other tabs New API endpoint for merge request count Updates all open tabs at the same time with one call Restructured API response API response changed to 401 if no current_user Added API + JS specs Fix for Static Check Updated Count on Open/Close, Assign/Unassign of MR's Checking if MR Count is refreshed Added # frozen_string_literal: true to spec Added Changelog --- lib/api/user_counts.rb | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 lib/api/user_counts.rb (limited to 'lib/api/user_counts.rb') diff --git a/lib/api/user_counts.rb b/lib/api/user_counts.rb new file mode 100644 index 00000000000..8df4b381bbf --- /dev/null +++ b/lib/api/user_counts.rb @@ -0,0 +1,18 @@ +# frozen_string_literal: true + +module API + class UserCounts < Grape::API + resource :user_counts do + desc 'Return the user specific counts' do + detail 'Open MR Count' + end + get do + unauthorized! unless current_user + + { + merge_requests: current_user.assigned_open_merge_requests_count + } + end + end + end +end -- cgit v1.2.1