Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'app/graphql/types/ci/catalog/resources/version_type.rb')
-rw-r--r--app/graphql/types/ci/catalog/resources/version_type.rb26
1 files changed, 18 insertions, 8 deletions
diff --git a/app/graphql/types/ci/catalog/resources/version_type.rb b/app/graphql/types/ci/catalog/resources/version_type.rb
index 689f649afc5..b52a1c6b13d 100644
--- a/app/graphql/types/ci/catalog/resources/version_type.rb
+++ b/app/graphql/types/ci/catalog/resources/version_type.rb
@@ -20,13 +20,13 @@ module Types
field :released_at, Types::TimeType, null: true, description: 'Timestamp of when the version was released.',
alpha: { milestone: '16.7' }
- field :tag_name, GraphQL::Types::String, null: true, method: :name,
- description: 'Name of the tag associated with the version.',
- alpha: { milestone: '16.7' }
+ field :name, GraphQL::Types::String, null: true,
+ description: 'Name that uniquely identifies the version within the catalog resource.',
+ alpha: { milestone: '16.8' }
- field :tag_path, GraphQL::Types::String, null: true,
- description: 'Relative web path to the tag associated with the version.',
- alpha: { milestone: '16.7' }
+ field :path, GraphQL::Types::String, null: true,
+ description: 'Relative web path to the version.',
+ alpha: { milestone: '16.8' }
field :author, Types::UserType, null: true, description: 'User that created the version.',
alpha: { milestone: '16.7' }
@@ -39,12 +39,22 @@ module Types
description: 'Components belonging to the catalog resource.',
alpha: { milestone: '16.7' }
+ field :readme_html, GraphQL::Types::String, null: true, calls_gitaly: true,
+ description: 'GitLab Flavored Markdown rendering of README.md. This field ' \
+ 'can only be resolved for one version in any single request.',
+ alpha: { milestone: '16.8' } do
+ extension ::Gitlab::Graphql::Limit::FieldCallCount, limit: 1 # To avoid N+1 calls to Gitaly
+ end
+
def author
Gitlab::Graphql::Loaders::BatchModelLoader.new(User, object.author_id).find
end
- def tag_path
- Gitlab::Routing.url_helpers.project_tag_path(object.project, object.name)
+ def readme_html
+ return unless Ability.allowed?(current_user, :read_code, object.project)
+
+ markdown_context = context.to_h.dup.merge(project: object.project)
+ ::MarkupHelper.markdown(object.readme&.data, markdown_context)
end
end
# rubocop: enable Graphql/AuthorizeTypes