From 2038e035c73f80292fa1bf9757803d8ab5e6ecab Mon Sep 17 00:00:00 2001
From: "Z.J. van de Weg" <zegerjan@gitlab.com>
Date: Thu, 18 Aug 2016 21:10:20 +0200
Subject: [PATCH] Do not expose projects on deployments

---
 doc/api/deployments.md | 166 -----------------------------------------
 lib/api/entities.rb    |   7 +-
 2 files changed, 3 insertions(+), 170 deletions(-)

diff --git a/doc/api/deployments.md b/doc/api/deployments.md
index 9a0d09d2623..417962de82d 100644
--- a/doc/api/deployments.md
+++ b/doc/api/deployments.md
@@ -67,62 +67,6 @@ Example of response
     },
     "id": 41,
     "iid": 1,
-    "project": {
-      "archived": false,
-      "avatar_url": null,
-      "builds_enabled": true,
-      "container_registry_enabled": true,
-      "created_at": "2016-08-11T07:31:46.777Z",
-      "creator_id": 1,
-      "default_branch": "master",
-      "description": "",
-      "forks_count": 0,
-      "http_url_to_repo": "http://localhost:3000/root/ci-project.git",
-      "id": 9,
-      "issues_enabled": true,
-      "last_activity_at": "2016-08-11T11:32:53.239Z",
-      "merge_requests_enabled": true,
-      "name": "ci-project",
-      "name_with_namespace": "Administrator / ci-project",
-      "namespace": {
-        "avatar": null,
-        "created_at": "2016-08-11T07:09:20.585Z",
-        "deleted_at": null,
-        "description": "",
-        "id": 1,
-        "name": "root",
-        "owner_id": 1,
-        "path": "root",
-        "request_access_enabled": true,
-        "share_with_group_lock": false,
-        "updated_at": "2016-08-11T07:09:20.585Z",
-        "visibility_level": 20
-      },
-      "open_issues_count": 0,
-      "owner": {
-        "avatar_url": "http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon",
-        "id": 1,
-        "name": "Administrator",
-        "state": "active",
-        "username": "root",
-        "web_url": "http://localhost:3000/u/root"
-      },
-      "path": "ci-project",
-      "path_with_namespace": "root/ci-project",
-      "public": false,
-      "public_builds": true,
-      "shared_runners_enabled": true,
-      "shared_with_groups": [
-      ],
-      "snippets_enabled": false,
-      "ssh_url_to_repo": "ssh://zegerjan@localhost:2222/root/ci-project.git",
-      "star_count": 0,
-      "tag_list": [
-      ],
-      "visibility_level": 0,
-      "web_url": "http://localhost:3000/root/ci-project",
-      "wiki_enabled": true
-    },
     "ref": "master",
     "sha": "99d03678b90d914dbb1b109132516d71a4a03ea8",
     "user": {
@@ -181,62 +125,6 @@ Example of response
     },
     "id": 42,
     "iid": 2,
-    "project": {
-      "archived": false,
-      "avatar_url": null,
-      "builds_enabled": true,
-      "container_registry_enabled": true,
-      "created_at": "2016-08-11T07:31:46.777Z",
-      "creator_id": 1,
-      "default_branch": "master",
-      "description": "",
-      "forks_count": 0,
-      "http_url_to_repo": "http://localhost:3000/root/ci-project.git",
-      "id": 9,
-      "issues_enabled": true,
-      "last_activity_at": "2016-08-11T11:32:53.239Z",
-      "merge_requests_enabled": true,
-      "name": "ci-project",
-      "name_with_namespace": "Administrator / ci-project",
-      "namespace": {
-        "avatar": null,
-        "created_at": "2016-08-11T07:09:20.585Z",
-        "deleted_at": null,
-        "description": "",
-        "id": 1,
-        "name": "root",
-        "owner_id": 1,
-        "path": "root",
-        "request_access_enabled": true,
-        "share_with_group_lock": false,
-        "updated_at": "2016-08-11T07:09:20.585Z",
-        "visibility_level": 20
-      },
-      "open_issues_count": 0,
-      "owner": {
-        "avatar_url": "http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon",
-        "id": 1,
-        "name": "Administrator",
-        "state": "active",
-        "username": "root",
-        "web_url": "http://localhost:3000/u/root"
-      },
-      "path": "ci-project",
-      "path_with_namespace": "root/ci-project",
-      "public": false,
-      "public_builds": true,
-      "shared_runners_enabled": true,
-      "shared_with_groups": [
-      ],
-      "snippets_enabled": false,
-      "ssh_url_to_repo": "ssh://zegerjan@localhost:2222/root/ci-project.git",
-      "star_count": 0,
-      "tag_list": [
-      ],
-      "visibility_level": 0,
-      "web_url": "http://localhost:3000/root/ci-project",
-      "wiki_enabled": true
-    },
     "ref": "master",
     "sha": "a91957a858320c0e17f3a0eca7cfacbff50ea29a",
     "user": {
@@ -275,60 +163,6 @@ Example of response
   "ref": "master",
   "sha": "a91957a858320c0e17f3a0eca7cfacbff50ea29a",
   "created_at": "2016-08-11T11:32:35.444Z",
-  "project": {
-    "id": 9,
-    "description": "",
-    "default_branch": "master",
-    "tag_list": [],
-    "public": false,
-    "archived": false,
-    "visibility_level": 0,
-    "ssh_url_to_repo": "ssh://zegerjan@localhost:2222/root/ci-project.git",
-    "http_url_to_repo": "http://localhost:3000/root/ci-project.git",
-    "web_url": "http://localhost:3000/root/ci-project",
-    "owner": {
-      "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/u/root"
-    },
-    "name": "ci-project",
-    "name_with_namespace": "Administrator / ci-project",
-    "path": "ci-project",
-    "path_with_namespace": "root/ci-project",
-    "issues_enabled": true,
-    "merge_requests_enabled": true,
-    "wiki_enabled": true,
-    "builds_enabled": true,
-    "snippets_enabled": false,
-    "container_registry_enabled": true,
-    "created_at": "2016-08-11T07:31:46.777Z",
-    "last_activity_at": "2016-08-11T11:32:53.239Z",
-    "shared_runners_enabled": true,
-    "creator_id": 1,
-    "namespace": {
-      "id": 1,
-      "name": "root",
-      "path": "root",
-      "owner_id": 1,
-      "created_at": "2016-08-11T07:09:20.585Z",
-      "updated_at": "2016-08-11T07:09:20.585Z",
-      "description": "",
-      "avatar": null,
-      "share_with_group_lock": false,
-      "visibility_level": 20,
-      "request_access_enabled": true,
-      "deleted_at": null
-    },
-    "avatar_url": null,
-    "star_count": 0,
-    "forks_count": 0,
-    "open_issues_count": 0,
-    "public_builds": true,
-    "shared_with_groups": []
-  },
   "user": {
     "name": "Administrator",
     "username": "root",
diff --git a/lib/api/entities.rb b/lib/api/entities.rb
index a10951b9ea0..67420772335 100644
--- a/lib/api/entities.rb
+++ b/lib/api/entities.rb
@@ -521,10 +521,9 @@ module API
 
     class Deployment < Grape::Entity
       expose :id, :iid, :ref, :sha, :created_at
-      expose :project,      using: Entities::Project
-      expose :user,         using: Entities::UserBasic
-      expose :environment,  using: Entities::EnvironmentBasic
-      expose :deployable,   using: Entities::Build
+      expose :user,        using: Entities::UserBasic
+      expose :environment, using: Entities::EnvironmentBasic
+      expose :deployable,  using: Entities::Build
     end
 
     class RepoLicense < Grape::Entity
-- 
GitLab