Commit Graph

55 Commits

Author SHA1 Message Date
GitLab Bot cd92e0ff98 Add latest changes from gitlab-org/gitlab@master 2023-08-17 12:09:15 +00:00
GitLab Bot 8470023ba6 Add latest changes from gitlab-org/gitlab@master 2023-08-15 12:10:41 +00:00
GitLab Bot 929b0ad500 Add latest changes from gitlab-org/gitlab@master 2023-08-08 21:10:34 +00:00
GitLab Bot 212d5da20b Add latest changes from gitlab-org/gitlab@master 2023-08-07 21:08:57 +00:00
GitLab Bot 638e2f1c5f Add latest changes from gitlab-org/gitlab@master 2023-06-06 15:09:27 +00:00
GitLab Bot 4ee706fcd1 Add latest changes from gitlab-org/gitlab@master 2022-12-01 12:09:35 +00:00
GitLab Bot 43feb20dca Add latest changes from gitlab-org/gitlab@master 2022-11-08 03:10:58 +00:00
GitLab Bot 14ae125e1c Add latest changes from gitlab-org/gitlab@master 2022-10-11 15:10:03 +00:00
GitLab Bot 8e656d0d45 Add latest changes from gitlab-org/gitlab@master 2022-10-07 06:09:36 +00:00
GitLab Bot 690c904b5e Add latest changes from gitlab-org/gitlab@master 2022-07-19 12:10:09 +00:00
GitLab Bot 7173270eb4 Add latest changes from gitlab-org/gitlab@master 2022-03-24 15:09:10 +00:00
GitLab Bot bd1bebd1b0 Add latest changes from gitlab-org/gitlab@master 2022-03-22 18:08:29 +00:00
GitLab Bot b131b6f680 Add latest changes from gitlab-org/gitlab@master 2022-03-11 03:08:14 +00:00
GitLab Bot 0a559c913e Add latest changes from gitlab-org/gitlab@master 2021-10-27 12:09:41 +00:00
GitLab Bot d4c968c95c Add latest changes from gitlab-org/gitlab@master 2021-06-21 12:07:45 +00:00
GitLab Bot a350f877c4 Add latest changes from gitlab-org/gitlab@master 2021-06-11 09:09:58 +00:00
GitLab Bot 98d7cc758f Add latest changes from gitlab-org/gitlab@master 2020-10-30 18:08:56 +00:00
GitLab Bot 6a0085290e Add latest changes from gitlab-org/gitlab@master 2020-10-15 00:08:42 +00:00
GitLab Bot 497d517e13 Add latest changes from gitlab-org/gitlab@master 2020-10-06 09:08:32 +00:00
GitLab Bot d022b7432e Add latest changes from gitlab-org/gitlab@master 2020-09-09 12:08:22 +00:00
GitLab Bot 4b9ace6c1f Add latest changes from gitlab-org/gitlab@master 2020-09-02 09:10:23 +00:00
GitLab Bot a70e2c0418 Add latest changes from gitlab-org/gitlab@master 2020-08-03 12:09:47 +00:00
GitLab Bot fcda041fc0 Add latest changes from gitlab-org/gitlab@master 2020-07-09 12:08:56 +00:00
GitLab Bot ae1efa2e1d Add latest changes from gitlab-org/gitlab@master 2020-07-01 15:08:45 +00:00
GitLab Bot 777f6da99a Add latest changes from gitlab-org/gitlab@master 2020-06-29 21:09:07 +00:00
GitLab Bot 553a22402b Add latest changes from gitlab-org/gitlab@master 2020-05-19 12:08:21 +00:00
GitLab Bot 48650fe1bf Add latest changes from gitlab-org/gitlab@master 2020-05-18 12:08:08 +00:00
GitLab Bot 2e4d8b3449 Add latest changes from gitlab-org/gitlab@master 2020-04-28 03:09:53 +00:00
GitLab Bot f569792df8 Add latest changes from gitlab-org/gitlab@master 2020-04-27 18:09:41 +00:00
GitLab Bot e33f87ac0f Add latest changes from gitlab-org/gitlab@master 2020-04-21 15:21:10 +00:00
GitLab Bot dc003cd08b Add latest changes from gitlab-org/gitlab@master 2020-03-26 18:08:03 +00:00
GitLab Bot 5ad0cf2655 Add latest changes from gitlab-org/gitlab@master 2020-01-23 12:08:38 +00:00
GitLab Bot efb0c7f501 Add latest changes from gitlab-org/gitlab@master 2020-01-17 00:09:00 +00:00
GitLab Bot 581c10e344 Add latest changes from gitlab-org/gitlab@master 2019-11-26 18:06:33 +00:00
GitLab Bot 8e75748aab Add latest changes from gitlab-org/gitlab@master 2019-11-22 06:06:20 +00:00
Nick Thomas e05a86cecd
Allow all personal snippets to be accessed by API
Previously, you could only access personal snippets in the API if you
had authored them. The documentation doesn't state that this is the
case, and it's quite surprising.
2019-03-06 09:05:03 +00:00
Francisco Javier López 9a5703ec82 Set content disposition attachment to several endpoints 2018-11-23 16:44:09 +00:00
Yorick Peterse d171ff6016
Rewrite SnippetsFinder to improve performance
This completely rewrites the SnippetsFinder class from the ground up in
order to improve its performance. The old code was beyond salvaging. It
was complex, included various Rails 5 workarounds, comments that
shouldn't be necessary, and most important of all: it produced a really
poorly performing database query.

As a result, I opted for rewriting the finder from scratch, instead of
trying to patch the existing code. Instead of trying to reuse as many
existing methods as possible, I opted for defining new methods
specifically meant for the SnippetsFinder. This requires some extra code
here and there, but allows us to have much more control over the
resulting SQL queries. It is these changes that then allow us to produce
a _much_ more efficient query.

To illustrate how bad the old query was, we will use my own snippets as
an example. Currently I have 52 snippets, most of which are global ones.
To retrieve these, you would run the following Ruby code:

    user = User.find_by(username: 'yorickpeterse')

    SnippetsFinder.new(user, author: user).execute

On GitLab.com the resulting query will take between 10 and 15 seconds to
run, producing the query plan found at
https://explain.depesz.com/s/Y5IX. Apart from the long execution time,
the total number of buffers (the sum of all shared hits) is around 185
GB, though the real number is probably (hopefully) much lower as I doubt
simply summing these numbers produces the true total number of buffers
used.

The new query's plan can be found at https://explain.depesz.com/s/wHdN,
and this query takes between 10 and 100-ish milliseconds to run. The
total number of buffers used is only about 30 MB.

Fixes https://gitlab.com/gitlab-org/gitlab-ce/issues/52639
2018-11-05 14:28:29 +01:00
gfyoung 3836d69119 Enable frozen string in lib/api and lib/backup
Partially addresses #47424.

Had to make changes to spec files because
stubbing methods on frozen objects is a mess
in RSpec and leads to failures:

https://github.com/rspec/rspec-mocks/issues/1190
2018-09-29 21:04:50 -07:00
Yorick Peterse 2039c8280d
Disable existing offenses for the CodeReuse cops
This whitelists all existing offenses for the various CodeReuse cops, of
which most are triggered by the CodeReuse/ActiveRecord cop.
2018-09-11 17:32:00 +02:00
🙈 jacopo beschi 🙉 c6b1043e9d Resolve "Make a Rubocop that forbids returning from a block" 2018-04-18 09:19:40 +00:00
Jacopo 181cd299f9 Adds Rubocop rule for line break after guard clause
Adds a rubocop rule (with autocorrect) to ensure line break after guard clauses.
2017-11-16 17:58:29 +01:00
Robert Schilling e80313f9ee Conditionally destroy a ressource 2017-08-28 16:40:25 +02:00
Robert Schilling 998afa5f74 API: Respect the 'If-Unmodified-Since' for delete endpoints 2017-08-28 16:40:25 +02:00
Dmitriy Zaporozhets 6b8ad689da
Update grape gem
New version of the gem returns 200 status code on delete with content
instead of 204 so we explicitly set status code to keep existing
behavior

Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
2017-07-20 16:33:18 +03:00
James Lopez 2aa95aa018 refactor code based on feedback 2017-07-06 15:27:49 +02:00
James Lopez 6ee87aea89 add user agent details API endpoints to issues and snippets 2017-07-06 15:27:48 +02:00
Jarka Kadlecova 4464c22d6d Support descriptions for snippets 2017-05-31 07:17:03 +02:00
Douwe Maan ad309f5d11 Merge branch 'snippets-finder-visibility' into 'security'
Refactor snippets finder & dont return internal snippets for external users

See merge request !2094
2017-05-10 16:48:18 +02:00
Toon Claes a3fdd6acd2 Use string based `visibility` getter & setter
Add `visibility` & `visibility=` methods to the
`Gitlab::VisibilityLevel` module so the `visibility_level` can be
get/set with a string value.
2017-03-02 12:15:25 +01:00