Commit d7c50b4a authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Merge branch 'api-events-username' into 'master'

Expose author username in project events API

Fixes gitlab/gitlabhq#1476

See merge request !1236
parents fe610ff5 9b251bd1
...@@ -6,6 +6,8 @@ v 7.5.0 ...@@ -6,6 +6,8 @@ v 7.5.0
- Add Atlassian Bamboo CI service (Drew Blessing) - Add Atlassian Bamboo CI service (Drew Blessing)
- Mentioned @user will receive email even if he is not participating in issue or commit - Mentioned @user will receive email even if he is not participating in issue or commit
- Tie up loose ends with annotated tags: API & UI (Sean Edge) - Tie up loose ends with annotated tags: API & UI (Sean Edge)
- Return valid json for deleting branch via API (sponsored by O'Reilly Media)
- Expose username in project events API (sponsored by O'Reilly Media)
v 7.4.2 v 7.4.2
- Fix internal snippet exposing for unauthenticated users - Fix internal snippet exposing for unauthenticated users
......
...@@ -186,6 +186,7 @@ Parameters: ...@@ -186,6 +186,7 @@ Parameters:
"target_id": 830, "target_id": 830,
"target_type": "Issue", "target_type": "Issue",
"author_id": 1, "author_id": 1,
"author_username": "john",
"data": null, "data": null,
"target_title": "Public project search field" "target_title": "Public project search field"
}, },
...@@ -196,6 +197,7 @@ Parameters: ...@@ -196,6 +197,7 @@ Parameters:
"target_id": null, "target_id": null,
"target_type": null, "target_type": null,
"author_id": 1, "author_id": 1,
"author_username": "john",
"data": { "data": {
"before": "50d4420237a9de7be1304607147aec22e4a14af7", "before": "50d4420237a9de7be1304607147aec22e4a14af7",
"after": "c5feabde2d8cd023215af4d2ceeb7a64839fc428", "after": "c5feabde2d8cd023215af4d2ceeb7a64839fc428",
...@@ -231,6 +233,7 @@ Parameters: ...@@ -231,6 +233,7 @@ Parameters:
"target_id": 840, "target_id": 840,
"target_type": "Issue", "target_type": "Issue",
"author_id": 1, "author_id": 1,
"author_username": "john",
"data": null, "data": null,
"target_title": "Finish & merge Code search PR" "target_title": "Finish & merge Code search PR"
} }
......
...@@ -183,6 +183,12 @@ module API ...@@ -183,6 +183,12 @@ module API
expose :target_id, :target_type, :author_id expose :target_id, :target_type, :author_id
expose :data, :target_title expose :data, :target_title
expose :created_at expose :created_at
expose :author_username do |event, options|
if event.author
event.author.username
end
end
end end
class Namespace < Grape::Entity class Namespace < Grape::Entity
......
...@@ -339,6 +339,7 @@ describe API::API, api: true do ...@@ -339,6 +339,7 @@ describe API::API, api: true do
json_event['action_name'].should == 'joined' json_event['action_name'].should == 'joined'
json_event['project_id'].to_i.should == project.id json_event['project_id'].to_i.should == project.id
json_event['author_username'].should == user.username
end end
it "should return a 404 error if not found" do it "should return a 404 error if not found" do
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment