Commit Graph

6 Commits

Author SHA1 Message Date
GitLab Bot c4844aea3f Add latest changes from gitlab-org/gitlab@master 2020-06-03 00:08:38 +00:00
Bob Van Landuyt 406808583c Render GFM html in GraphQL
This adds a `markdown_field` to our types.

Using this helper will render a model's markdown field using the
existing `MarkupHelper` with the context of the GraphQL query
available to the helper.

Having the context available to the helper is needed for redacting
links to resources that the current user is not allowed to see.

Because rendering the HTML can cause queries, the complexity of a
these fields is raised by 5 above the default.

The markdown field helper can be used as follows:

      ```
      markdown_field :note_html, null: false
      ```

This would generate a field that will render the markdown field `note`
of the model. This could be overridden by adding the `method:`
argument. Passing a symbol for the method name:

      ```
      markdown_field :body_html, null: false, method: :note
      ```

It will have this description by default:

> The GitLab Flavored Markdown rendering of `note`

This could be overridden by passing a `description:` argument.

The type of a `markdown_field` is always `GraphQL::STRING_TYPE`.
2019-06-20 08:02:33 +00:00
Bob Van Landuyt ed503d51a3 Expose IDs in GraphQL as a GlobalID
This exposes all fields named `id` as GlobalIDs so they can be used
across our entire GraphQL implementation.

When the objects loaded are `ApplicationRecord`s. We'll use our
existing batchloading to find them. Otherwise, we'll fall back to the
default implementation of `GlobalID`: Calling the `.find` method on
the class.
2019-06-03 21:59:25 +02:00
gfyoung 47b3038434 Enable frozen string in app/graphql + app/finders
Partially addresses #47424.
2018-09-11 12:15:23 -07:00
Bob Van Landuyt 54b56f20b7 Expose permissions on types in GraphQL
This adds a reusable way to expose permissions for a user to types in
GraphQL.
2018-06-28 13:50:17 +02:00
Bob Van Landuyt 9b65d4bb41 Initial setup GraphQL using graphql-ruby 1.8
- All definitions have been replaced by classes:
  http://graphql-ruby.org/schema/class_based_api.html
- Authorization & Presentation have been refactored to work in the
  class based system
- Loaders have been replaced by resolvers
- Times are now coersed as ISO 8601
2018-06-06 10:58:54 +02:00