summaryrefslogtreecommitdiff
path: root/lib/api
diff options
context:
space:
mode:
authorTim Zallmann <tzallmann@gitlab.com>2019-07-09 08:44:19 +0000
committerKushal Pandya <kushalspandya@gmail.com>2019-07-09 08:44:19 +0000
commitb9e52612feb4956f0b3cc26af0f98810e67a5287 (patch)
treed9b851e9ef3e50cdb7e4ad181d5313666a17e0fe /lib/api
parent9d079194652b94c7cf9d94b4c757ffa1fcdfbcf1 (diff)
downloadgitlab-ce-b9e52612feb4956f0b3cc26af0f98810e67a5287.tar.gz
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
Diffstat (limited to 'lib/api')
-rw-r--r--lib/api/api.rb1
-rw-r--r--lib/api/user_counts.rb18
2 files changed, 19 insertions, 0 deletions
diff --git a/lib/api/api.rb b/lib/api/api.rb
index 42499c5b41e..7016a66593d 100644
--- a/lib/api/api.rb
+++ b/lib/api/api.rb
@@ -166,6 +166,7 @@ module API
mount ::API::Templates
mount ::API::Todos
mount ::API::Triggers
+ mount ::API::UserCounts
mount ::API::Users
mount ::API::Variables
mount ::API::Version
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