Commit a0856e61 authored by Heinrich Lee Yu's avatar Heinrich Lee Yu

Merge branch 'members-created-by' into 'master'

Add changed_by field to API members entities

See merge request gitlab-org/gitlab!66518
parents ce3e9b18 c0e336bc
......@@ -63,6 +63,15 @@ Example response:
"state": "active",
"avatar_url": "https://www.gravatar.com/avatar/c2525a7f58ae3776070e44c106c48e15?s=80&d=identicon",
"web_url": "http://192.168.1.8:3000/root",
"created_at": "2012-09-22T14:13:35Z",
"created_by": {
"id": 2,
"username": "john_doe",
"name": "John Doe",
"state": "active",
"avatar_url": "https://www.gravatar.com/avatar/c2525a7f58ae3776070e44c106c48e15?s=80&d=identicon",
"web_url": "http://192.168.1.8:3000/root"
},
"expires_at": "2012-10-22T14:13:35Z",
"access_level": 30,
"group_saml_identity": null,
......@@ -75,6 +84,15 @@ Example response:
"state": "active",
"avatar_url": "https://www.gravatar.com/avatar/c2525a7f58ae3776070e44c106c48e15?s=80&d=identicon",
"web_url": "http://192.168.1.8:3000/root",
"created_at": "2012-09-22T14:13:35Z",
"created_by": {
"id": 1,
"username": "raymond_smith",
"name": "Raymond Smith",
"state": "active",
"avatar_url": "https://www.gravatar.com/avatar/c2525a7f58ae3776070e44c106c48e15?s=80&d=identicon",
"web_url": "http://192.168.1.8:3000/root"
},
"expires_at": "2012-10-22T14:13:35Z",
"access_level": 30,
"email": "john@example.com",
......@@ -132,6 +150,15 @@ Example response:
"state": "active",
"avatar_url": "https://www.gravatar.com/avatar/c2525a7f58ae3776070e44c106c48e15?s=80&d=identicon",
"web_url": "http://192.168.1.8:3000/root",
"created_at": "2012-09-22T14:13:35Z",
"created_by": {
"id": 2,
"username": "john_doe",
"name": "John Doe",
"state": "active",
"avatar_url": "https://www.gravatar.com/avatar/c2525a7f58ae3776070e44c106c48e15?s=80&d=identicon",
"web_url": "http://192.168.1.8:3000/root"
},
"expires_at": "2012-10-22T14:13:35Z",
"access_level": 30,
"group_saml_identity": null,
......@@ -144,6 +171,15 @@ Example response:
"state": "active",
"avatar_url": "https://www.gravatar.com/avatar/c2525a7f58ae3776070e44c106c48e15?s=80&d=identicon",
"web_url": "http://192.168.1.8:3000/root",
"created_at": "2012-09-22T14:13:35Z",
"created_by": {
"id": 1,
"username": "raymond_smith",
"name": "Raymond Smith",
"state": "active",
"avatar_url": "https://www.gravatar.com/avatar/c2525a7f58ae3776070e44c106c48e15?s=80&d=identicon",
"web_url": "http://192.168.1.8:3000/root"
},
"expires_at": "2012-10-22T14:13:35Z",
"access_level": 30,
"email": "john@example.com",
......@@ -161,6 +197,15 @@ Example response:
"state": "active",
"avatar_url": "https://www.gravatar.com/avatar/c2525a7f58ae3776070e44c106c48e15?s=80&d=identicon",
"web_url": "http://192.168.1.8:3000/root",
"created_at": "2012-10-22T14:13:35Z",
"created_by": {
"id": 2,
"username": "john_doe",
"name": "John Doe",
"state": "active",
"avatar_url": "https://www.gravatar.com/avatar/c2525a7f58ae3776070e44c106c48e15?s=80&d=identicon",
"web_url": "http://192.168.1.8:3000/root"
},
"expires_at": "2012-11-22T14:13:35Z",
"access_level": 30,
"group_saml_identity": null,
......@@ -201,6 +246,14 @@ Example response:
"access_level": 30,
"email": "john@example.com",
"created_at": "2012-10-22T14:13:35Z",
"created_by": {
"id": 2,
"username": "john_doe",
"name": "John Doe",
"state": "active",
"avatar_url": "https://www.gravatar.com/avatar/c2525a7f58ae3776070e44c106c48e15?s=80&d=identicon",
"web_url": "http://192.168.1.8:3000/root"
},
"expires_at": null,
"group_saml_identity": null,
"membership_state": "active"
......@@ -239,6 +292,15 @@ Example response:
"avatar_url": "https://www.gravatar.com/avatar/c2525a7f58ae3776070e44c106c48e15?s=80&d=identicon",
"web_url": "http://192.168.1.8:3000/root",
"access_level": 30,
"created_at": "2012-10-22T14:13:35Z",
"created_by": {
"id": 2,
"username": "john_doe",
"name": "John Doe",
"state": "active",
"avatar_url": "https://www.gravatar.com/avatar/c2525a7f58ae3776070e44c106c48e15?s=80&d=identicon",
"web_url": "http://192.168.1.8:3000/root"
},
"email": "john@example.com",
"expires_at": null,
"group_saml_identity": null,
......@@ -454,6 +516,15 @@ Example response:
"state": "active",
"avatar_url": "https://www.gravatar.com/avatar/c2525a7f58ae3776070e44c106c48e15?s=80&d=identicon",
"web_url": "http://192.168.1.8:3000/root",
"created_at": "2012-10-22T14:13:35Z",
"created_by": {
"id": 2,
"username": "john_doe",
"name": "John Doe",
"state": "active",
"avatar_url": "https://www.gravatar.com/avatar/c2525a7f58ae3776070e44c106c48e15?s=80&d=identicon",
"web_url": "http://192.168.1.8:3000/root"
},
"expires_at": "2012-10-22T14:13:35Z",
"access_level": 30,
"email": "john@example.com",
......@@ -492,6 +563,15 @@ Example response:
"state": "active",
"avatar_url": "https://www.gravatar.com/avatar/c2525a7f58ae3776070e44c106c48e15?s=80&d=identicon",
"web_url": "http://192.168.1.8:3000/root",
"created_at": "2012-10-22T14:13:35Z",
"created_by": {
"id": 2,
"username": "john_doe",
"name": "John Doe",
"state": "active",
"avatar_url": "https://www.gravatar.com/avatar/c2525a7f58ae3776070e44c106c48e15?s=80&d=identicon",
"web_url": "http://192.168.1.8:3000/root"
},
"expires_at": "2012-10-22T14:13:35Z",
"access_level": 40,
"email": "john@example.com",
......@@ -529,6 +609,15 @@ Example response:
"state": "active",
"avatar_url": "https://www.gravatar.com/avatar/c2525a7f58ae3776070e44c106c48e15?s=80&d=identicon",
"web_url": "http://192.168.1.8:3000/root",
"created_at": "2012-10-22T14:13:35Z",
"created_by": {
"id": 2,
"username": "john_doe",
"name": "John Doe",
"state": "active",
"avatar_url": "https://www.gravatar.com/avatar/c2525a7f58ae3776070e44c106c48e15?s=80&d=identicon",
"web_url": "http://192.168.1.8:3000/root"
},
"expires_at": "2012-10-22T14:13:35Z",
"access_level": 40,
"email": "john@example.com",
......@@ -566,6 +655,15 @@ Example response:
"state": "active",
"avatar_url": "https://www.gravatar.com/avatar/c2525a7f58ae3776070e44c106c48e15?s=80&d=identicon",
"web_url": "http://192.168.1.8:3000/root",
"created_at": "2012-10-22T14:13:35Z",
"created_by": {
"id": 2,
"username": "john_doe",
"name": "John Doe",
"state": "active",
"avatar_url": "https://www.gravatar.com/avatar/c2525a7f58ae3776070e44c106c48e15?s=80&d=identicon",
"web_url": "http://192.168.1.8:3000/root"
},
"expires_at": "2012-10-22",
"access_level": 40,
"email": "john@example.com",
......
......@@ -6,6 +6,7 @@ module API
expose :user, merge: true, using: UserBasic
expose :access_level
expose :created_at
expose :created_by, with: UserBasic, expose_nil: false
expose :expires_at
end
end
......
......@@ -11,16 +11,16 @@ RSpec.describe API::Members do
let(:project) do
create(:project, :public, creator_id: maintainer.id, namespace: maintainer.namespace) do |project|
project.add_developer(developer)
project.add_maintainer(maintainer)
project.add_developer(developer, current_user: maintainer)
project.request_access(access_requester)
end
end
let!(:group) do
create(:group, :public) do |group|
group.add_developer(developer)
group.add_owner(maintainer)
group.add_developer(developer, maintainer)
create(:group_member, :minimal_access, source: group, user: user_with_minimal_access)
group.request_access(access_requester)
end
......@@ -50,6 +50,10 @@ RSpec.describe API::Members do
expect(json_response).to be_an Array
expect(json_response.size).to eq(2)
expect(json_response.map { |u| u['id'] }).to match_array [maintainer.id, developer.id]
expect(json_response).to contain_exactly(
a_hash_including('created_by' => a_hash_including('id' => maintainer.id)),
hash_not_including('created_by')
)
end
end
end
......
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