Commit Graph

104 Commits

Author SHA1 Message Date
GitLab Bot da35510cda Add latest changes from gitlab-org/gitlab@master 2019-10-17 21:06:41 +00:00
GitLab Bot 238d22c072 Add latest changes from gitlab-org/gitlab@master 2019-10-17 15:06:17 +00:00
GitLab Bot 5ecacec304 Add latest changes from gitlab-org/gitlab@master 2019-10-04 15:06:38 +00:00
GitLab Bot 25521def84 Add latest changes from gitlab-org/gitlab@master 2019-10-03 18:06:11 +00:00
GitLab Bot d14219486e Add latest changes from gitlab-org/gitlab@master 2019-10-02 03:06:35 +00:00
GitLab Bot 587794b4b8 Add latest changes from gitlab-org/gitlab@master 2019-10-02 00:06:26 +00:00
GitLab Bot 2b3007dc96 Add latest changes from gitlab-org/gitlab@master 2019-09-20 18:06:35 +00:00
GitLab Bot 80f61b4035 Add latest changes from gitlab-org/gitlab@master 2019-09-18 14:02:45 +00:00
GitLab Bot 930ff68c1e Add latest changes from gitlab-org/gitlab@master 2019-09-16 18:06:05 +00:00
GitLab Bot b7dfe2ae40 Add latest changes from gitlab-org/gitlab@master 2019-09-13 13:26:31 +00:00
Maneschi Romain dbca77e346 If user can't activate error tracking display a learn more button pointing
to doc
2019-09-05 21:17:36 +00:00
Brett Walker aa7b1cfc5b Upgrade GraphQL gem to 1.8.17
- Due to https://github.com/exAspArk/batch-loader/pull/32,
we  changed BatchLoader.for into BatchLoader::GraphQL.for
- since our results are wrapped in a BatchLoader::GraphQL,
calling `sync` during authorization is required to get real object
- `graphql` now has it's own authorization system.  Our
`authorized?` method conflicted and required renaming
2019-09-04 17:42:48 +00:00
Brett Walker bdd5b5b695 Replace echo function with a resolver
The `GraphQL::Function` has been deprecated in
favor of resolvers.
2019-08-26 17:43:38 +00:00
Lucy Fox b89df39468 Update gitlab_schema.rb to fix typo 2019-08-26 08:48:06 +00:00
Alessio Caiazza 606a1d2d31 Expose namespace storage statistics with GraphQL
Root namespaces have storage statistics.
This commit allows namespace owners to get those stats via GraphQL
queries like the following one

{
  namespace(fullPath: "a_namespace_path") {
    rootStorageStatistics {
      storageSize
      repositorySize
      lfsObjectsSize
      buildArtifactsSize
      packagesSize
      wikiSize
    }
  }
}
2019-08-22 22:08:28 +00:00
Luke Duncalfe 15b02da69f Use AwardEmojis services in GraphQL mutations
https://gitlab.com/gitlab-org/gitlab-ce/issues/63372
2019-08-21 11:39:41 +12:00
Heinrich Lee Yu 1ce5bcacdb Remove code related to object hierarchy in MySQL
These are not required because MySQL is not
supported anymore
2019-07-25 15:35:06 +08:00
Igor 0f46886880 Added submodule links to Submodule type in GraphQL API
This is part of migration of Folder View to Vue
2019-07-17 13:06:19 +00:00
Luke Duncalfe 67030789f5 Include AuthorizeResource module for all mutations
This makes our authorization calls available to all GraphQL mutations
without the additional step of including the module first.
2019-07-11 15:08:34 +12:00
Luke Duncalfe 073c8b25ea GraphQL support for Notes created in discussions
A new `discussion_id` argument on the `createNote` mutation allows
people to create a note within that discussion.

The ability to lazy-load Discussions has been added, so
GraphQL.object_from_id can treat Discussions the same as AR objects and
batch load them.

https://gitlab.com/gitlab-org/gitlab-ce/issues/62826
https://gitlab.com/gitlab-org/gitlab-ee/issues/9489
2019-07-10 12:13:48 +12:00
Luke Duncalfe 254f78f5dc Expose diff_refs on MergeRequestType
https://gitlab.com/gitlab-org/gitlab-ee/issues/9489
2019-07-10 12:13:48 +12:00
Luke Duncalfe a00a23ca82 GraphQL mutations for managing Notes
https://gitlab.com/gitlab-org/gitlab-ce/issues/62826
2019-07-10 12:13:47 +12:00
charlieablett 675c9b9f6b Address reviewer comments
- Remove Gitaly call check for fields that have a constant complexity
declared
- Add associated test
2019-07-05 10:18:50 +12:00
charlieablett cf1b0d10bc Address reviewer comments
- Add 1 for all fields that call Gitaly (with resolvers or without)
- Clarify comment regarding Gitaly call alert
- Expose predicate `calls_gitaly?` instead of ivar
2019-07-03 22:53:13 +12:00
charlieablett a11fe5de44 Wrap proc properly in gitaly call counts
- Add `calls_gitaly: true` to some fields missing (hey, it works!)
- Clarify proc wrapping
- Add kwargs argument to `mount_mutation`
2019-07-03 22:53:13 +12:00
charlieablett f4890d9078 Alert if `calls_gitaly` declaration missing
- Move `calls_gitaly_check` to public
- Add instrumentation for flagging missing CallsGitaly declarations
- Wrap resolver proc in before-and-after Gitaly counts to get the net
Gitaly call count for the resolver.
2019-07-03 22:53:13 +12:00
charlieablett c99c30fdd6 Remove potentially noisy warning
- If Gitaly calls are missing, it could be due to a conditional and
may just become noise
2019-07-03 22:53:13 +12:00
charlieablett 8b809837f4 Enumerate fields with Gitaly calls
- Add a complexity of 1 if Gitaly is called at least once
 - Add an error notification if `calls_gitaly` isn't right for a
 particular field
2019-07-03 22:53:13 +12:00
Marin Jankovski c20c9e2940
Merge branch 'master' of gitlab.com:gitlab-org/gitlab-ce 2019-07-03 11:55:56 +02:00
Lin Jen-Shin 2321b337f1 Merge branch 'graphql-tree-last-commit' into 'master'
Added commit type to tree GraphQL type

See merge request gitlab-org/gitlab-ce!29412
2019-06-28 10:02:57 +00:00
Phil Hughes d78f7ceac9
Added commit type to tree GraphQL type 2019-06-28 08:30:29 +01:00
Luke Duncalfe 4b9b2a43d0 GraphQL mutations for add, remove and toggle emoji
Adding new `AddAwardEmoji`, `RemoveAwardEmoji` and `ToggleAwardEmoji`
GraphQL mutations.

Adding new `#authorized_find_with_pre_checks!` and (unused, but for
completeness `#authorized_find_with_post_checks!`) authorization
methods. These allow us to perform an authorized find, and run our own
additional checks before or after the authorization runs.

https://gitlab.com/gitlab-org/gitlab-ce/issues/62826
2019-06-28 12:03:33 +12:00
Bob Van Landuyt 967cbd0834 Enforce authorizations for non-nullable fields
This makes sure we also enforce authorizations for non-nullable
fields.

We are defining our authorizations on the unwrapped
types (Repository). But when a type like that is presented in a
non-nullable field, it's type is different (Repository!). The
non-nullable type would not have the authorization metadata.

This makes sure we check the metadata on the unwrapped type for
finding authorizations.
2019-06-21 13:00:50 +02:00
Bob Van Landuyt 703d0246ff Add authorize to LabelType and NamespaceType
This also disables the cop with a reasoning in types where appropriate
2019-06-21 13:00:50 +02: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
Sean McGivern e398409a74 Merge branch '62910-task-completion-status-gql-pderichs' into 'master'
Make task completion status available via GraphQL

Closes #62910

See merge request gitlab-org/gitlab-ce!29573
2019-06-17 08:12:36 +00:00
Patrick Derichs 453a9b298c Add task count and completed count to graphql types
Add specs for task completion status (graphql)

Fix style issues

Changed format of constants in spec

Refactor specs to reduce creation of records

Reduce parameters to merge request creation

Use set's for project and user

Move let's out of it_behaves_like block

Fix description parameter

Fix format of lets

Use dig to get task completion status out of graphql response

Modified rspec output

Add changelog entry
2019-06-15 06:56:28 +02:00
Mayra Cabrera d7f10c2949 Do not blindly expose public project statistics
Add the missing check on GraphQL API for project statistics
2019-06-14 20:40:21 +00:00
Bob Van Landuyt b6ff5f1e14 Expose comments on Noteables in GraphQL
This exposes `Note`s on Issues & MergeRequests using a
`Types::Notes::NoteableType` in GraphQL.

Exposing notes on a new type can be done by implementing the
`NoteableType` interface on the type. The presented object should
be a `Noteable`.
2019-06-14 12:36:27 +02:00
Bob Van Landuyt c70f7ec77b Rename `BatchCommitLoader` to `BatchLfsOidLoader`
Since we're not actually  loading commits in that loader, but we're
loading blobs with LFS oids in batch and returning only the oids.
2019-06-11 16:11:21 +02:00
Phil Hughes 522c01972c
Add LFS blob ID to GraphQL blob type 2019-06-10 09:05:44 +01:00
Jan Provaznik 9318fba9cb Merge branch '62706-graphql-complexity-values-are-incorrectly-doubled' into 'master'
Reduce GraphQL complexity for non-connection fields

Closes #62706

See merge request gitlab-org/gitlab-ce!29165
2019-06-06 11:54:30 +00:00
Nick Thomas 327c7d5a07 Merge branch 'graphql-file-entry-url' into 'master'
Add web_url to tree entry in GraphQL API

See merge request gitlab-org/gitlab-ce!28646
2019-06-05 15:44:53 +00:00
Brett Walker 0cedd43ef7 Grab field_defn to access certain values 2019-06-05 10:17:54 -05:00
Brett Walker 95b3fe2863 Use :complexity_multiplier only with connections
This helps reduce complexity for non-connections
2019-06-05 10:17:54 -05:00
Jan Provaznik d9a761ed14 Merge branch 'bvl-use-global-ids-graphql' into 'master'
Use global IDs when exposing GraphQL resources

Closes #62650

See merge request gitlab-org/gitlab-ce!29080
2019-06-05 10:25:22 +00:00
Phil Hughes 4644a2daf5
Add web_url to tree entry in GraphQL API 2019-06-05 08:46:32 +01:00
Alessio Caiazza 4e251d01de Expose wiki_size on GraphQL API 2019-06-04 12:11:41 +00:00
Bob Van Landuyt f16b13113f Fix incorrect instances of `GraphQL::ID_TYPE`
Since the `GraphQL::ID_TYPE` usages should represent globally unique
ids, this changes some fields for which this is not the case into
strings.

The `ID_TYPE` is a specialised, so this change should be backwards
compatible.

https://graphql-ruby.org/type_definitions/scalars.html
2019-06-03 21:59:33 +02: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