Commit Graph

14 Commits

Author SHA1 Message Date
GitLab Bot eba30e2ad8 Add latest changes from gitlab-org/gitlab@master 2020-12-16 00:09:58 +00:00
GitLab Bot fa7ac2663b Add latest changes from gitlab-org/gitlab@master 2020-06-24 06:09:01 +00:00
GitLab Bot b6847c621f Add latest changes from gitlab-org/gitlab@master 2020-04-03 18:10:03 +00:00
GitLab Bot 2a040e2655 Add latest changes from gitlab-org/gitlab@master 2020-02-21 12:09:07 +00:00
GitLab Bot 4aeb8a02c5 Add latest changes from gitlab-org/gitlab@master 2019-12-23 12:08:18 +00:00
GitLab Bot abfafe3c57 Add latest changes from gitlab-org/gitlab@master 2019-10-29 00:06:10 +00:00
Stan Hu e24b9c2502 Eliminate Gitaly N+1 queries with notes API
Similar to https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/31834,
we see that in https://gitlab.com/gitlab-org/gitlab-ce/issues/65957
there can be hundreds, even thousands, of Gitaly requests in the
`/api/:version/projects/:id/merge_requests/:noteable_id/notes` endpoint.

Previously, the API to retrieve notes generated hundreds of Gitaly calls
to determine whether a system note should be shown to the user. It did
this by:

1. Rendering the Markdown
2. Extracting cross-references from the Markdown
3. Issuing a Gitaly `FindCommit` RPC for every reference to validate
that the commit exists.

The last step is unnecessary because we don't need to display a commit
if the user doesn't have access to the project in the first place.
`RendersNotes#prepare_notes_for_rendering` is already used in
`MergeRequestsController`, which is why we don't see N+1 Gitaly calls
there. We use it here to optimize the note redaction process.
2019-08-22 22:28:47 -07:00
Stan Hu b288f128fe Fix failing N+1 spec in spec/requests/api/discussions_spec.rb
This test was failing in EE because the API helper `get()` creates a
personal access token each time it's run. We can avoid that by
pre-creating a personal access token and passing it each time.
2019-08-15 11:54:42 -07:00
Stan Hu 8044440d7a Eliminate many Gitaly calls in discussions API
Previously, the API to retrieve discussions from merge requests often
generated hundreds of Gitaly calls to determine whether a system note
should be shown to the user. It did this by:

1. Rendering the Markdown
2. Extracting cross-references from the Markdown
3. For cross-references that were commits, a Gitaly FindCommit RPC
   would be issued to validate that the commit exists.

The last step is unnecessary because we don't need to display a commit
if the user doesn't have access to the project in the first place.

`RendersNotes#prepare_notes_for_rendering` is already used in
`MergeRequestsController`, which is why we don't see N+1 Gitaly calls
there. We use it here to optimize the note redaction process.

Closes https://gitlab.com/gitlab-org/gitlab-ce/issues/65957
2019-08-15 08:02:30 -07:00
Yoginth 2f6a20ce66 Fix typos in the whole gitlab-ce project 2019-05-20 14:11:44 +00:00
Sean McGivern 00af4c6d6a Allow replying to an individual note in the API
If you can do this in the UI, you should be able to do it in the API. If
a discussion is not a single note discussion, or it is replyable, you
can reply to it.
2019-05-06 19:48:32 +01:00
Rémy Coutable 3a2abc1d50
Enable the Layout/ExtraSpacing cop
Signed-off-by: Rémy Coutable <remy@rymai.me>
2019-01-24 13:05:45 +01:00
Jan Provaznik 7a76caa5a8 Merge request and commit discussions API 2018-05-01 12:39:44 +00:00
Jan Provaznik dcdfa04b32 Add discussion API
* adds basic discussions API for issues and snippets
* reorganizes notes specs (so same tests can be used for all noteable types - issues, MRs, snippets)
2018-03-07 12:27:50 +01:00