summaryrefslogtreecommitdiff
path: root/lib/api/entities.rb
diff options
context:
space:
mode:
authorToon Claes <toon@gitlab.com>2017-03-01 16:16:29 +0100
committerToon Claes <toon@gitlab.com>2017-03-02 09:33:24 +0100
commitb2c2dfe545526a1857e9605761f6d256ef73e190 (patch)
treeba3ec9ea7ce38a4c2ca09b6d92a3d67bb492daf1 /lib/api/entities.rb
parentfc287191451bb6aac80d759ab521b5834d27df43 (diff)
downloadgitlab-ce-b2c2dfe545526a1857e9605761f6d256ef73e190.tar.gz
Expose Project's & ProjectSnippet's VisibilityLevel as String
Instead of exposing the VisibilityLevel as Integer, expose it as String `visibility` for Project and ProjectSnippet. Filter queries also accept the `visibility` as String instead of `visibility_level` as Integer. Also remove the `public` boolean.
Diffstat (limited to 'lib/api/entities.rb')
-rw-r--r--lib/api/entities.rb4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/api/entities.rb b/lib/api/entities.rb
index 9dccaff369e..bcdd0573e57 100644
--- a/lib/api/entities.rb
+++ b/lib/api/entities.rb
@@ -69,9 +69,9 @@ module API
class Project < Grape::Entity
expose :id, :description, :default_branch, :tag_list
- expose :public?, as: :public
expose :archived?, as: :archived
- expose :visibility_level, :ssh_url_to_repo, :http_url_to_repo, :web_url
+ expose :ssh_url_to_repo, :http_url_to_repo, :web_url
+ expose(:visibility) { |project, _options| Gitlab::VisibilityLevel.string_level(project.visibility_level) }
expose :owner, using: Entities::UserBasic, unless: ->(project, options) { project.group }
expose :name, :name_with_namespace
expose :path, :path_with_namespace