Commit Graph

35 Commits

Author SHA1 Message Date
GitLab Bot bf53a3fd78 Add latest changes from gitlab-org/gitlab@master 2023-09-19 03:09:45 +00:00
GitLab Bot 89297ece08 Add latest changes from gitlab-org/gitlab@master 2023-05-25 03:07:34 +00:00
GitLab Bot d4b2ad25a5 Add latest changes from gitlab-org/gitlab@master 2023-01-09 21:08:39 +00:00
GitLab Bot f9053931de Add latest changes from gitlab-org/gitlab@master 2023-01-05 09:07:31 +00:00
GitLab Bot 7d99ad1b87 Add latest changes from gitlab-org/gitlab@master 2022-12-25 06:07:04 +00:00
GitLab Bot af60c8a79f Add latest changes from gitlab-org/gitlab@master 2022-12-14 09:08:01 +00:00
GitLab Bot 4ee706fcd1 Add latest changes from gitlab-org/gitlab@master 2022-12-01 12:09:35 +00:00
GitLab Bot f50cb4f63f Add latest changes from gitlab-org/gitlab@master 2021-10-27 15:13:41 +00:00
GitLab Bot 0ae8428c8e Add latest changes from gitlab-org/gitlab@master 2021-05-11 21:10:21 +00:00
GitLab Bot 889bf7a0ee Add latest changes from gitlab-org/gitlab@master 2021-03-16 18:11:53 +00:00
GitLab Bot dafbc31897 Add latest changes from gitlab-org/gitlab@master 2021-01-26 21:09:04 +00:00
GitLab Bot ce27ba9f6c Add latest changes from gitlab-org/gitlab@master 2020-10-29 18:09:11 +00:00
GitLab Bot b86a07e9b7 Add latest changes from gitlab-org/gitlab@master 2020-07-29 21:09:52 +00:00
GitLab Bot 5c763ac4c6 Add latest changes from gitlab-org/gitlab@master 2020-05-27 06:08:13 +00:00
GitLab Bot 8f9beefac3 Add latest changes from gitlab-org/gitlab@master 2020-03-23 12:09:47 +00:00
GitLab Bot 07d0374b20 Add latest changes from gitlab-org/gitlab@master 2020-02-24 03:09:05 +00:00
GitLab Bot 167894d0e7 Add latest changes from gitlab-org/gitlab@master 2020-01-24 21:09:09 +00:00
GitLab Bot 5ad0cf2655 Add latest changes from gitlab-org/gitlab@master 2020-01-23 12:08:38 +00:00
GitLab Bot b7dfe2ae40 Add latest changes from gitlab-org/gitlab@master 2019-09-13 13:26:31 +00:00
Patrick Derichs c9b4dc677a Filter out old system notes for epics 2019-08-28 15:04:23 +02: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
Patrick Derichs c69a47049c Use NotesFinder#target to find Epics 2019-08-04 21:04:31 +02:00
Patrick Derichs 0e99daae4a Use NotesFinder in IssuableActions module
Remove project from NotesFinder constructor

Add project parameter to specs

Also look for methods in private scope

Fix specs to match new NotesFinder constructor
2019-08-01 10:42:42 +02:00
Patrick Derichs 5469d21d02 Simplify result of find_noteable 2019-06-19 11:07:17 +02:00
Patrick Derichs 932a9a0c77 Use NotesFinder to fetch notes on API and Controllers
Fix missing iid query on NotesFinder

Changed parameters of find_noteable, 
so changes across a few files were needed.
MergeRequest also requires iid instead of id query

Make NotesFinder fail with RecordNotFound again

Add specs for target_iid

Using RSpec tablesyntax for target_iid specs

Revert "Using RSpec tablesyntax for target_iid specs"

This reverts commit ba45c7f569a.

Allow find_by! here

Fix variable name

Add readable check

Revert "Add readable check"

This reverts commit 9e3a1a7aa39.

Remove unnecessary assignment

Add required changes for EE

Fix parameter count

Reduce code duplication by extracting a noteable module method

The call to find_noteable was redundant so
multiple files and lines have changed in that
commit to use the newly introduced module
method `noteable`.

Replace casecmp with include check

Add parent_type parameter


Revert "Reduce code duplication by extracting
a noteable module method"

This reverts commit 8c0923babf.

Method is no longer needed

Check whether noteable can be read by user
2019-06-19 10:56:55 +02:00
Robert Speicher ccbbc1000d Merge branch 'resolve-lib-differences' into 'master'
Resolve CE to EE differences in the lib/api directory

See merge request gitlab-org/gitlab-ce!25430
2019-03-12 17:03:50 +00:00
Igor Drozdov 5169dafccf Forbid creating discussions for users with restricted access 2019-03-04 18:37:08 +00:00
Yorick Peterse 654c4dd922
Refactor API noteable types constants
This replaces API::Notes::NOTEABLE_TYPES and
API::Discussions::NOTEABLE_TYPES with class methods defined in a
separate helper modules. This allows EE to extend the list of noteable
types, without having to modify the constant in-place. We can't define
these methods directly in the API classes, as they would be used before
we're able to extend them in EE.
2019-03-04 17:44:56 +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
Sean McGivern aff7dccc1f Use policies to determine if attributes can be set in the API
This is more idiomatic than checking membership explicitly.
2018-08-22 14:17:29 +01:00
Florent Dubois b63ed7cff6 Allow date parameters on Issues and Notes API for group owners
- Allow `created_at` and `updated_at` parameters on Issues API
- Allow `created_at` on Issue Notes API

Closes gitlab-org/gitlab-ce#40059
2018-08-22 12:16:48 +01:00
Kia Mei Somabes 37af75a2e0 Resolve "do not set updated_at when creating note" 2018-07-12 09:26:09 +00:00
Jan Provaznik 7a76caa5a8 Merge request and commit discussions API 2018-05-01 12:39:44 +00:00
Lin Jen-Shin ab286656b2 Resolve "Namespace factory is problematic" 2018-04-23 15:48:26 +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