From 0a94bdfa1473d7e876e3a34be75a205a64b5056a Mon Sep 17 00:00:00 2001 From: Alexis Reigel Date: Tue, 25 Sep 2018 16:28:57 +0200 Subject: [PATCH 1/3] add missing user attributes to api docs --- doc/api/deployments.md | 51 +++++++++++++----------- doc/api/jobs.md | 90 +++++++++++++++++++++++------------------- doc/api/keys.md | 7 ++++ 3 files changed, 84 insertions(+), 64 deletions(-) diff --git a/doc/api/deployments.md b/doc/api/deployments.md index fd11894ea8f..7cfa55159bd 100644 --- a/doc/api/deployments.md +++ b/doc/api/deployments.md @@ -46,19 +46,20 @@ Example of response "status": "success", "tag": false, "user": { - "avatar_url": "http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon", - "bio": null, - "created_at": "2016-08-11T07:09:20.351Z", "id": 1, - "linkedin": "", - "location": null, "name": "Administrator", - "skype": "", - "state": "active", - "twitter": "", "username": "root", - "web_url": "http://localhost:3000/root", - "website_url": "" + "state": "active", + "avatar_url": "http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon", + "web_url": "http://gitlab.dev/root", + "created_at": "2015-12-21T13:14:24.077Z", + "bio": null, + "location": null, + "skype": "", + "linkedin": "", + "twitter": "", + "website_url": "", + "organization": "" } }, "environment": { @@ -103,19 +104,20 @@ Example of response "status": "success", "tag": false, "user": { - "avatar_url": "http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon", - "bio": null, - "created_at": "2016-08-11T07:09:20.351Z", "id": 1, - "linkedin": "", - "location": null, "name": "Administrator", - "skype": "", - "state": "active", - "twitter": "", "username": "root", - "web_url": "http://localhost:3000/root", - "website_url": "" + "state": "active", + "avatar_url": "http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon", + "web_url": "http://gitlab.dev/root", + "created_at": "2015-12-21T13:14:24.077Z", + "bio": null, + "location": null, + "skype": "", + "linkedin": "", + "twitter": "", + "website_url": "", + "organization": "" } }, "environment": { @@ -188,19 +190,20 @@ Example of response "started_at": null, "finished_at": "2016-08-11T11:32:35.145Z", "user": { + "id": 1, "name": "Administrator", "username": "root", - "id": 1, "state": "active", "avatar_url": "http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon", - "web_url": "http://localhost:3000/root", - "created_at": "2016-08-11T07:09:20.351Z", + "web_url": "http://gitlab.dev/root", + "created_at": "2015-12-21T13:14:24.077Z", "bio": null, "location": null, "skype": "", "linkedin": "", "twitter": "", - "website_url": "" + "website_url": "", + "organization": "" }, "commit": { "id": "a91957a858320c0e17f3a0eca7cfacbff50ea29a", diff --git a/doc/api/jobs.md b/doc/api/jobs.md index cf292adf150..eebe746c750 100644 --- a/doc/api/jobs.md +++ b/doc/api/jobs.md @@ -53,18 +53,20 @@ Example of response "tag": false, "web_url": "https://example.com/foo/bar/-/jobs/6", "user": { - "avatar_url": "http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon", - "bio": null, - "created_at": "2015-12-21T13:14:24.077Z", "id": 1, - "linkedin": "", "name": "Administrator", - "skype": "", - "state": "active", - "twitter": "", "username": "root", + "state": "active", + "avatar_url": "http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon", "web_url": "http://gitlab.dev/root", - "website_url": "" + "created_at": "2015-12-21T13:14:24.077Z", + "bio": null, + "location": null, + "skype": "", + "linkedin": "", + "twitter": "", + "website_url": "", + "organization": "" } }, { @@ -109,18 +111,20 @@ Example of response "tag": false, "web_url": "https://example.com/foo/bar/-/jobs/7", "user": { - "avatar_url": "http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon", - "bio": null, - "created_at": "2015-12-21T13:14:24.077Z", "id": 1, - "linkedin": "", "name": "Administrator", - "skype": "", - "state": "active", - "twitter": "", "username": "root", + "state": "active", + "avatar_url": "http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon", "web_url": "http://gitlab.dev/root", - "website_url": "" + "created_at": "2015-12-21T13:14:24.077Z", + "bio": null, + "location": null, + "skype": "", + "linkedin": "", + "twitter": "", + "website_url": "", + "organization": "" } } ] @@ -180,18 +184,20 @@ Example of response "tag": false, "web_url": "https://example.com/foo/bar/-/jobs/6", "user": { - "avatar_url": "http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon", - "bio": null, - "created_at": "2015-12-21T13:14:24.077Z", "id": 1, - "linkedin": "", "name": "Administrator", - "skype": "", - "state": "active", - "twitter": "", "username": "root", + "state": "active", + "avatar_url": "http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon", "web_url": "http://gitlab.dev/root", - "website_url": "" + "created_at": "2015-12-21T13:14:24.077Z", + "bio": null, + "location": null, + "skype": "", + "linkedin": "", + "twitter": "", + "website_url": "", + "organization": "" } }, { @@ -236,18 +242,20 @@ Example of response "tag": false, "web_url": "https://example.com/foo/bar/-/jobs/7", "user": { - "avatar_url": "http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon", - "bio": null, - "created_at": "2015-12-21T13:14:24.077Z", "id": 1, - "linkedin": "", "name": "Administrator", - "skype": "", - "state": "active", - "twitter": "", "username": "root", + "state": "active", + "avatar_url": "http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon", "web_url": "http://gitlab.dev/root", - "website_url": "" + "created_at": "2015-12-21T13:14:24.077Z", + "bio": null, + "location": null, + "skype": "", + "linkedin": "", + "twitter": "", + "website_url": "", + "organization": "" } } ] @@ -305,18 +313,20 @@ Example of response "tag": false, "web_url": "https://example.com/foo/bar/-/jobs/8", "user": { - "avatar_url": "http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon", - "bio": null, - "created_at": "2015-12-21T13:14:24.077Z", "id": 1, - "linkedin": "", "name": "Administrator", - "skype": "", - "state": "active", - "twitter": "", "username": "root", + "state": "active", + "avatar_url": "http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon", "web_url": "http://gitlab.dev/root", - "website_url": "" + "created_at": "2015-12-21T13:14:24.077Z", + "bio": null, + "location": null, + "skype": "", + "linkedin": "", + "twitter": "", + "website_url": "", + "organization": "" } } ``` diff --git a/doc/api/keys.md b/doc/api/keys.md index ddcf7830621..0044fbfe66c 100644 --- a/doc/api/keys.md +++ b/doc/api/keys.md @@ -27,10 +27,15 @@ Parameters: "web_url": "http://localhost:3000/john_smith", "created_at": "2015-09-03T07:24:01.670Z", "bio": null, + "location": null, "skype": "", "linkedin": "", "twitter": "", "website_url": "", + "organization": null, + "last_sign_in_at": "2015-09-03T07:24:01.670Z", + "confirmed_at": "2015-09-03T07:24:01.670Z", + "last_activity_on": "2015-09-03", "email": "john@example.com", "theme_id": 2, "color_scheme_id": 1, @@ -40,6 +45,8 @@ Parameters: "can_create_group": true, "can_create_project": true, "two_factor_enabled": false + "external": false, + "private_profile": null } } ``` From 585b1b3fca46cd7241701e5159a76501796ca091 Mon Sep 17 00:00:00 2001 From: Alexis Reigel Date: Tue, 25 Sep 2018 18:40:24 +0200 Subject: [PATCH 2/3] add user's public_email attribute to api --- doc/api/deployments.md | 2 ++ doc/api/jobs.md | 5 +++++ doc/api/keys.md | 1 + doc/api/runners.md | 1 + doc/api/users.md | 4 ++++ lib/api/entities.rb | 2 +- 6 files changed, 14 insertions(+), 1 deletion(-) diff --git a/doc/api/deployments.md b/doc/api/deployments.md index 7cfa55159bd..1963b0a21de 100644 --- a/doc/api/deployments.md +++ b/doc/api/deployments.md @@ -55,6 +55,7 @@ Example of response "created_at": "2015-12-21T13:14:24.077Z", "bio": null, "location": null, + "public_email": "", "skype": "", "linkedin": "", "twitter": "", @@ -113,6 +114,7 @@ Example of response "created_at": "2015-12-21T13:14:24.077Z", "bio": null, "location": null, + "public_email": "", "skype": "", "linkedin": "", "twitter": "", diff --git a/doc/api/jobs.md b/doc/api/jobs.md index eebe746c750..aa290ff4cf8 100644 --- a/doc/api/jobs.md +++ b/doc/api/jobs.md @@ -62,6 +62,7 @@ Example of response "created_at": "2015-12-21T13:14:24.077Z", "bio": null, "location": null, + "public_email": "", "skype": "", "linkedin": "", "twitter": "", @@ -120,6 +121,7 @@ Example of response "created_at": "2015-12-21T13:14:24.077Z", "bio": null, "location": null, + "public_email": "", "skype": "", "linkedin": "", "twitter": "", @@ -193,6 +195,7 @@ Example of response "created_at": "2015-12-21T13:14:24.077Z", "bio": null, "location": null, + "public_email": "", "skype": "", "linkedin": "", "twitter": "", @@ -251,6 +254,7 @@ Example of response "created_at": "2015-12-21T13:14:24.077Z", "bio": null, "location": null, + "public_email": "", "skype": "", "linkedin": "", "twitter": "", @@ -322,6 +326,7 @@ Example of response "created_at": "2015-12-21T13:14:24.077Z", "bio": null, "location": null, + "public_email": "", "skype": "", "linkedin": "", "twitter": "", diff --git a/doc/api/keys.md b/doc/api/keys.md index 0044fbfe66c..06b31a67d6a 100644 --- a/doc/api/keys.md +++ b/doc/api/keys.md @@ -28,6 +28,7 @@ Parameters: "created_at": "2015-09-03T07:24:01.670Z", "bio": null, "location": null, + "public_email": "john@example.com", "skype": "", "linkedin": "", "twitter": "", diff --git a/doc/api/runners.md b/doc/api/runners.md index 66476e7db64..94ad11f44d7 100644 --- a/doc/api/runners.md +++ b/doc/api/runners.md @@ -286,6 +286,7 @@ Example response: "created_at": "2017-11-16T18:38:46.000Z", "bio": null, "location": null, + "public_email": "", "skype": "", "linkedin": "", "twitter": "", diff --git a/doc/api/users.md b/doc/api/users.md index b0ae455a025..762ea53edee 100644 --- a/doc/api/users.md +++ b/doc/api/users.md @@ -199,6 +199,7 @@ Parameters: "created_at": "2012-05-23T08:00:58Z", "bio": null, "location": null, + "public_email": "john@example.com", "skype": "", "linkedin": "", "twitter": "", @@ -230,6 +231,7 @@ Parameters: "is_admin": false, "bio": null, "location": null, + "public_email": "john@example.com", "skype": "", "linkedin": "", "twitter": "", @@ -367,6 +369,7 @@ GET /user "created_at": "2012-05-23T08:00:58Z", "bio": null, "location": null, + "public_email": "john@example.com", "skype": "", "linkedin": "", "twitter": "", @@ -415,6 +418,7 @@ GET /user "is_admin": false, "bio": null, "location": null, + "public_email": "john@example.com", "skype": "", "linkedin": "", "twitter": "", diff --git a/lib/api/entities.rb b/lib/api/entities.rb index 0fec3dc3dc4..12c4340c1ba 100644 --- a/lib/api/entities.rb +++ b/lib/api/entities.rb @@ -53,7 +53,7 @@ module API class User < UserBasic expose :created_at, if: ->(user, opts) { Ability.allowed?(opts[:current_user], :read_user_profile, user) } - expose :bio, :location, :skype, :linkedin, :twitter, :website_url, :organization + expose :bio, :location, :public_email, :skype, :linkedin, :twitter, :website_url, :organization end class UserActivity < Grape::Entity From f920d996e34dfb8f8933ff7c5798fa1a72c357b6 Mon Sep 17 00:00:00 2001 From: Alexis Reigel Date: Tue, 25 Sep 2018 18:56:59 +0200 Subject: [PATCH 3/3] add changelog --- .../unreleased/feature-add-public-email-to-users-api.yml | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 changelogs/unreleased/feature-add-public-email-to-users-api.yml diff --git a/changelogs/unreleased/feature-add-public-email-to-users-api.yml b/changelogs/unreleased/feature-add-public-email-to-users-api.yml new file mode 100644 index 00000000000..1f5d3fb113d --- /dev/null +++ b/changelogs/unreleased/feature-add-public-email-to-users-api.yml @@ -0,0 +1,5 @@ +--- +title: Adds the user's public_email attribute to the API +merge_request: 21909 +author: Alexis Reigel +type: added