summaryrefslogtreecommitdiff
path: root/lib/api
diff options
context:
space:
mode:
authorSean McGivern <sean@gitlab.com>2017-04-12 12:19:45 +0100
committerRémy Coutable <remy@rymai.me>2017-04-14 15:20:55 +0200
commit91ac0e038ab51dd2f30f2bb7c91837fa588ca250 (patch)
tree54b5ea7cb6115a09bbcead558252563664b4898c /lib/api
parent3cb84e06b7a118fb46b4e1e0d4885026c9d4a4d1 (diff)
downloadgitlab-ce-91ac0e038ab51dd2f30f2bb7c91837fa588ca250.tar.gz
Port 'Add user activities API' to CE
CE port of https://gitlab.com/gitlab-org/gitlab-ee/merge_requests/962
Diffstat (limited to 'lib/api')
-rw-r--r--lib/api/entities.rb5
-rw-r--r--lib/api/issues.rb2
-rw-r--r--lib/api/users.rb18
3 files changed, 24 insertions, 1 deletions
diff --git a/lib/api/entities.rb b/lib/api/entities.rb
index 9919762cd82..939cedc1b27 100644
--- a/lib/api/entities.rb
+++ b/lib/api/entities.rb
@@ -18,6 +18,11 @@ module API
expose :bio, :location, :skype, :linkedin, :twitter, :website_url, :organization
end
+ class UserActivity < Grape::Entity
+ expose :username
+ expose :last_activity_at
+ end
+
class Identity < Grape::Entity
expose :provider, :extern_uid
end
diff --git a/lib/api/issues.rb b/lib/api/issues.rb
index 05423c17449..244725bb292 100644
--- a/lib/api/issues.rb
+++ b/lib/api/issues.rb
@@ -35,7 +35,7 @@ module API
optional :assignee_id, type: Integer, desc: 'The ID of a user to assign issue'
optional :milestone_id, type: Integer, desc: 'The ID of a milestone to assign issue'
optional :labels, type: String, desc: 'Comma-separated list of label names'
- optional :due_date, type: String, desc: 'Date time string in the format YEAR-MONTH-DAY'
+ optional :due_date, type: String, desc: 'Date string in the format YEAR-MONTH-DAY'
optional :confidential, type: Boolean, desc: 'Boolean parameter if the issue should be confidential'
end
diff --git a/lib/api/users.rb b/lib/api/users.rb
index eedc59f8636..16fa1ef6836 100644
--- a/lib/api/users.rb
+++ b/lib/api/users.rb
@@ -534,6 +534,24 @@ module API
email.destroy
current_user.update_secondary_emails!
end
+
+
+ desc 'Get a list of user activities'
+ params do
+ optional :from, type: String, desc: 'Date string in the format YEAR-MONTH-DAY'
+ use :pagination
+ end
+ get ":activities" do
+ authenticated_as_admin!
+
+ activity_set = Gitlab::UserActivities::ActivitySet.new(from: params[:from],
+ page: params[:page],
+ per_page: params[:per_page])
+
+ add_pagination_headers(activity_set)
+
+ present activity_set.activities, with: Entities::UserActivity
+ end
end
end
end