2020-02-10 19:09:06 -05:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
module API
|
|
|
|
module Entities
|
|
|
|
class NamespaceBasic < Grape::Entity
|
|
|
|
expose :id, :name, :path, :kind, :full_path, :parent_id, :avatar_url
|
|
|
|
|
|
|
|
expose :web_url do |namespace|
|
2021-09-21 11:12:11 -04:00
|
|
|
if namespace.user_namespace?
|
2020-02-10 19:09:06 -05:00
|
|
|
Gitlab::Routing.url_helpers.user_url(namespace.owner)
|
|
|
|
else
|
|
|
|
namespace.web_url
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|