summaryrefslogtreecommitdiff
path: root/lib/api/notes.rb
Commit message (Collapse)AuthorAgeFilesLines
* Eliminate Gitaly N+1 queries with notes APIsh-eliminate-gitaly-nplus-one-notesStan Hu2019-08-221-6/+7
| | | | | | | | | | | | | | | | | | | | | | 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.
* Use NotesFinder to fetch notes on API and ControllersPatrick Derichs2019-06-191-7/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 8c0923babff16. Method is no longer needed Check whether noteable can be read by user
* Refactor API noteable types constantsYorick Peterse2019-03-041-3/+1
| | | | | | | | | 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.
* Added: Include order by ID desc for tie breakers in paginationNermin Vehabovic2019-02-161-1/+1
|
* Fix API::Namespaces to accept namepaces with dotsif-52811-fix_namespaces_api_routingImre Farkas2018-11-281-1/+1
| | | | | It also renames the API::PROJECT_ENDPOINT_REQUIREMENTS constant to API::NAMESPACE_OR_PROJECT_REQUIREMENTS
* Enable frozen string in lib/api and lib/backupgfyoung2018-09-291-0/+2
| | | | | | | | | | 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
* Disable existing offenses for the CodeReuse copsYorick Peterse2018-09-111-0/+2
| | | | | This whitelists all existing offenses for the various CodeReuse cops, of which most are triggered by the CodeReuse/ActiveRecord cop.
* Merge request and commit discussions APIJan Provaznik2018-05-011-17/+13
|
* Add discussion APIjprovazn-apiJan Provaznik2018-03-071-66/+28
| | | | | * adds basic discussions API for issues and snippets * reorganizes notes specs (so same tests can be used for all noteable types - issues, MRs, snippets)
* support ordering of project notes in notes apihaseeb2017-11-291-1/+6
|
* add `#with_metadata` scope to remove a N+1 from the notes' APImicael.bergeron2017-11-211-2/+2
|
* Create system notes for MR too, improve doc + clean up codeJarka Kadlecova2017-09-141-7/+2
|
* Support discussion lock in the APIJarka Kadlecova2017-09-141-0/+7
|
* API: Use defined project requirementsrs-api-use-project-requirementsRobert Schilling2017-08-311-1/+1
|
* Conditionally destroy a ressourceRobert Schilling2017-08-281-3/+3
|
* API: Respect the 'If-Unmodified-Since' for delete endpointsRobert Schilling2017-08-281-0/+2
|
* Re-enable SqlInjection and CommandInjectionBrian Neel2017-08-081-1/+1
|
* Update grape gemdz-update-grapeDmitriy Zaporozhets2017-07-201-0/+1
| | | | | | | | 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>
* Enable Style/DotPosition Rubocop :cop:Grzegorz Bizon2017-06-211-2/+2
|
* Remove the User#is_admin? methodblackst0ne2017-04-091-1/+1
|
* API: Make the /notes endpoint work with noteable iid instead of idToon Claes2017-03-271-5/+9
| | | | | | | | | | | | | | | | In API V4 all endpoints were changed so Merge Requests and Issues should be referred by iid, instead of id. Except the /notes endpoint was forgotten. So change the endpoints from: - /projects/:id/issues/:issue_id/notes - /projects/:id/merge_requests/:merge_request_id/notes To: - /projects/:id/issues/:issue_iid/notes - /projects/:id/merge_requests/:merge_request_iid/notes For Project Snippets nothing changes.
* Add `requirements: { id: %r{[^/]+} }` for all projects and groups namespaced ↵Rémy Coutable2017-03-161-1/+1
| | | | | | API routes Signed-off-by: Rémy Coutable <remy@rymai.me>
* Return 204 for delete endpointsRobert Schilling2017-02-281-2/+0
|
* Revert "Prefer leading style for Style/DotPosition"Douwe Maan2017-02-231-2/+2
| | | | This reverts commit cb10b725c8929b8b4460f89c9d96c773af39ba6b.
* Prefer leading style for Style/DotPositionDouwe Maan2017-02-231-2/+2
|
* Enable Style/ColonMethodCallDouwe Maan2017-02-231-1/+1
|
* Enable Style/MutableConstantDouwe Maan2017-02-231-1/+1
|
* Fix inconsistent naming for services that delete thingsdixpac2017-02-081-1/+1
| | | | | | * Changed name of delete_user_service and worker to destroy * Move and change delete_group_service to Groups::DestroyService * Rename Notes::DeleteService to Notes::DestroyService
* Merge branch 'fix-guest-access-posting-to-notes' into 'security' Robert Speicher2017-01-231-10/+16
| | | | | Prevent users from creating notes on resources they can't access See https://dev.gitlab.org/gitlab/gitlabhq/merge_requests/2054
* Parameter already enforced via grapeclean-api-paramsRobert Schilling2016-12-281-2/+0
|
* Use the pagination helper in the APIuse-pagination-helperRobert Schilling2016-12-041-1/+3
|
* Grapify the notes APIgrapify-notes-apiRobert Schilling2016-11-151-67/+57
|
* Fix API notes endpoint when posting only emojiZ.J. van de Weg2016-09-161-4/+4
|
* Sort API endpoints and implement feedbackZ.J. van de Weg2016-06-171-1/+1
|
* Move note helper method to notes entity fileissue_17302Felipe Artur2016-05-171-2/+8
|
* Fix single note api requestFelipe Artur2016-05-161-5/+5
|
* Fix notes API calls symbol convertionsFelipe Artur2016-05-101-3/+3
|
* Fix api leaking notes when user is not authorized to read noteableFelipe Artur2016-05-091-13/+18
|
* Allow back dating notes on creationMichael Greene2016-04-131-0/+5
|
* Adapt tests to new testing guidelinesRobert Schilling2016-04-121-0/+2
|
* Fix code review issuesRobert Schilling2016-04-121-4/+2
|
* Delete notes via APIRobert Schilling2016-04-121-0/+17
|
* Ensure the API doesn't return notes that the current user shouldn't seeRémy Coutable2016-01-131-2/+19
|
* Show who last edited a comment if it wasn't the original authorDouwe Maan2015-07-301-7/+5
|
* Add a message when unable to save an object through api.Marin Jankovski2015-01-071-1/+1
|
* Forward the messages in api response.Marin Jankovski2014-12-301-1/+1
|
* Implemented notes (body) patching in API.uran2014-12-251-0/+33
|
* Fix notes creation via APIDmitriy Zaporozhets2014-06-181-5/+8
| | | | Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
* Wipe wall notes featureDmitriy Zaporozhets2014-06-131-49/+0
| | | | Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
* Remove thread vars usage from API notes and mr'sDmitriy Zaporozhets2014-06-101-22/+18
| | | | Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>